Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace make stuff to python stuff #1613

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -461,35 +461,6 @@ endif()



#
# Custom targets
#

add_custom_target(python_unit_tests
COMMAND ${PYTHON} ${PROJECT_SOURCE_DIR}/scripts/run_tests.py -u --coverage
COMMENT "Python unit tests")

add_custom_target(python_integration_tests
COMMAND ${PYTHON} ${PROJECT_SOURCE_DIR}/scripts/run_tests.py -i --coverage
COMMENT "Python integration tests")

add_custom_target(python_swarming_tests
COMMAND ${PYTHON} ${PROJECT_SOURCE_DIR}/scripts/run_tests.py -w --coverage
COMMENT "Python swarming tests")

add_custom_target(python_all_tests
COMMAND ${PYTHON} ${PROJECT_SOURCE_DIR}/scripts/run_tests.py --all --coverage # swarming tests fail with the -n parallel run
COMMENT "Python tests + integration + swarming (requires DB)")

add_custom_target(tests_pyhtm
COMMAND testpyhtm
COMMENT "Basic tests in Python")

add_custom_target(tests_all
DEPENDS python_all_tests
DEPENDS tests_pyhtm
COMMENT "Running all tests")

#
# Installation targets
#
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,17 @@ If you want to develop, debug, or simply test NuPIC, [clone](/~https://github.com/

#### To run the tests:

cd $NUPIC/build/scripts
# Python HTM Network API tests
make tests_pyhtm
# Python OPF unit tests
make python_unit_tests
# Python OPF integration tests
make python_integration_tests
# Python OPF swarming tests (requires mysql)
make python_swarming_tests
# Python unit tests
python $NUPIC/scripts/run_tests.py -u --coverage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously we recommended this:

./run_tests.sh ...

If you want to switch to run_tests.py then perhaps we should remove run_tests.sh. Eventually I think we should remove all of the test runners and in the README recommend py.test ... instead since that gives people the most flexibility (and they could use nose or whatever their preferred test runner is).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like @oxtopus to chime in on this too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to switch to run_tests.py then perhaps we should remove run_tests.sh.

I also would remove as we want leave the repo more pythonic and cross-platform. It's ok, @oxtopus ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm the only one who still wants run_tests.sh, but I give it up!! 😉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The run_tests.sh is there because of a policy at Numenta to have consistent entry points for invoking tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The run_tests.sh is there because of a policy at Numenta to have consistent entry points for invoking tests.

setuptools.setup has a entry_points and scripts parameters which allows we specify python scripts to be installed in the system and may be called in everywhere on shell only typing its name. This is the case of nustudio on nupic.studio:

/~https://github.com/nupic-community/nupic.studio/blob/master/setup.py#L37

I simply type nustudio on the shell (not matter from where I call it) and voilá! NuPIC Studio is executed!

I believe that these ones are the right (read default) way to call entry points in Python projects.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhyolight @oxtopus @scottpurdy

Please look this:
#1622


# Python integration tests
python $NUPIC/scripts/run_tests.py -i --coverage

# Python swarming tests (requires mysql)
python $NUPIC/scripts/run_tests.py -w --coverage

# Run all tests!
make tests_all
python $NUPIC/scripts/run_tests.py --all --coverage

### Using an IDE

Expand Down
8 changes: 2 additions & 6 deletions ci/travis/script-run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,11 @@ echo
echo Running script-run-tests.sh...
echo

cd $TRAVIS_BUILD_DIR/build/scripts
# legacy binary tests
make tests_pyhtm || exit

# Python unit tests and prep for coveralls reporting
make python_unit_tests || exit
python ${TRAVIS_BUILD_DIR}/scripts/run_tests.py -u --coverage || exit

mv ${TRAVIS_BUILD_DIR}/.coverage ${TRAVIS_BUILD_DIR}/.coverage_unit
# Python integration tests and prep for coveralls reporting
make python_integration_tests || exit
python ${TRAVIS_BUILD_DIR}/scripts/run_tests.py -i --coverage || exit

mv ${TRAVIS_BUILD_DIR}/.coverage ${TRAVIS_BUILD_DIR}/.coverage_integration
4 changes: 1 addition & 3 deletions coreos-vagrant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,5 @@ Then, launch the docker container, replacing the id with your own:
Then, cd into /usr/local/src/nupic and run tests:

cd /usr/local/src/nupic/build/scripts
make tests_htm
make tests_pyhtm
make python_unit_tests
python $NUPIC/scripts/run_tests.py --all --coverage