Skip to content

Commit

Permalink
Tackle comments + some tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
lesteve committed Nov 13, 2017
1 parent 5869fbf commit 39089f6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
7 changes: 4 additions & 3 deletions build_tools/travis/test_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ if [[ "$SKIP_TESTS" != "true" ]]; then
fi

if [[ "$CHECK_PYTEST_SOFT_DEPENDENCY" == "true" ]]; then
conda remove -y py pytest || echo "pytest not found by conda"
pip uninstall -y py pytest || echo "pytest not found by pip"
conda remove -y py pytest || pip uninstall -y py pytest
if [[ "$COVERAGE" == "true" ]]; then
CMD="coverage run -a"
# Need to append the coverage to the existing .coverage generated by
# running the tests
CMD="coverage run --apend"
else
CMD="python"
fi
Expand Down
10 changes: 9 additions & 1 deletion sklearn/utils/tests/test_estimator_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ def __init__(self):
NonConformantEstimator)


if __name__ == '__main__':
def run_tests_without_pytest():
"""Runs the tests in this file without using pytest.
"""
main_module = sys.modules['__main__']
test_functions = [getattr(main_module, name) for name in dir(main_module)
if name.startswith('test_')]
Expand All @@ -265,3 +267,9 @@ def __init__(self):
suite.addTests(test_cases)
runner = unittest.TextTestRunner()
runner.run(suite)


if __name__ == '__main__':
# This module is run as a script to check that we have no dependency on
# pytest for estimator checks.
run_tests_without_pytest()

0 comments on commit 39089f6

Please sign in to comment.