[MRG] Replace assert_* methods with "assert" keyword statements.#430
[MRG] Replace assert_* methods with "assert" keyword statements.#430lesteve merged 5 commits intojoblib:masterfrom
Conversation
|
@lesteve Expect another PR once this is done. I'm here for addressing your reviews, if any 😄 |
|
LGTM in general. There is an assert_less than you missed: $ git grep 'assert_less'
joblib/test/test_hashing.py:def assert_less(a, b):
joblib/test/test_hashing.py: assert_less(relative_diff, 0.3)
joblib/test/test_hashing.py: assert_less(relative_diff, 0.3) |
|
And some assert_equal or assert_not_equal that can still be removed I think $ git grep -P 'assert_equal|assert_not_equal' | grep -v yield
joblib/test/test_disk.py:from joblib.testing import assert_equal, assert_raises
joblib/test/test_func_inspect.py:from joblib.testing import (assert_equal, assert_raises_regex, assert_raises)
joblib/test/test_hashing.py:from joblib.testing import (assert_equal, assert_not_equal,
joblib/test/test_memory.py:from joblib.testing import (assert_equal, assert_true, assert_false,
joblib/test/test_numpy_pickle.py:from joblib.testing import (assert_equal, assert_raises, assert_raises_regex,
joblib/test/test_numpy_pickle.py: np.testing.assert_equal(result, expected)
joblib/test/test_numpy_pickle.py: np.testing.assert_equal(result, expected)
joblib/test/test_parallel.py:from joblib.testing import (assert_equal, assert_raises, check_subprocess_call,
joblib/test/test_parallel.py: assert_equal(queue, [
joblib/test/test_parallel.py: assert_equal(queue, [
joblib/test/test_parallel.py: assert_equal(first_four,
joblib/testing.py:assert_equal = _dummy.assertEqual
joblib/testing.py:assert_not_equal = _dummy.assertNotEqual |
|
I originally thought that bare assert would not play nice with nosetests (not sure why maybe it was the case at one point) but actually I tried and nosetests seem to support as well as the |
|
All the assert_true and assert_false can go as well eventually. |
|
I missed regex replacement of |
|
You still have a few |
|
@lesteve I have left the |
|
Meanwhile I would like to give an update - I have tested on both Travis and Appveyor - my fork has commits which have Once that comes in position, I will ⭐ pytestify ⭐ each module (already done two modules on my local git repo! I fear getting entangled so I am introducing small incremental changes on Github 😅 If we keep up the pace, this migration would be done before the year ends ! 🏁 |
Good point sorry I missed that.
This is definitely the best way to get PR reviewed and merged quickly, thanks a lot for that!
Sounds great! |
around import statements that fit on one line.
|
I have pushed a small cosmetic change in your branch. I will merge once the CIs are green. |
|
Merging, thanks a lot @karandesai-96! |
* commit '0.10.2-55-g660fe5d': (52 commits) MAINT simplify way to skip doctests Do not print frames with IPython internals in format_stack BF(TST): compare for version in pickled filename ignoring full path, and looking for _ as well (joblib#445) [MRG] Remove nose dependency completely. (joblib#441) MAINT add Python 3.5 in setup.py Remove some Python 2.6 specific code [MRG] Make test execution on CI possible through py.test command. (joblib#433) Remove more python 2.6 related code (joblib#440) [MRG] Use commit range for diff in flake8_diff.sh (joblib#439) MAINT remove support for python 2.6 (joblib#437) Improve doc about caching methods (joblib#432) Get the tests passing with py.test MAINT update flake8_diff.sh COSMIT move stdlib imports where they belong [MRG] Replace assert_* methods with "assert" keyword statements. (joblib#430) Reraise when the exception is not a TransportableException (joblib#429) Make sure LICENSE.txt is included in the wheel Add LICENSE.txt Update doc/paralle.rst [MRG+1] Remove all nose imports from test scripts. (joblib#422) ...
* releases: (52 commits) MAINT simplify way to skip doctests Do not print frames with IPython internals in format_stack BF(TST): compare for version in pickled filename ignoring full path, and looking for _ as well (joblib#445) [MRG] Remove nose dependency completely. (joblib#441) MAINT add Python 3.5 in setup.py Remove some Python 2.6 specific code [MRG] Make test execution on CI possible through py.test command. (joblib#433) Remove more python 2.6 related code (joblib#440) [MRG] Use commit range for diff in flake8_diff.sh (joblib#439) MAINT remove support for python 2.6 (joblib#437) Improve doc about caching methods (joblib#432) Get the tests passing with py.test MAINT update flake8_diff.sh COSMIT move stdlib imports where they belong [MRG] Replace assert_* methods with "assert" keyword statements. (joblib#430) Reraise when the exception is not a TransportableException (joblib#429) Make sure LICENSE.txt is included in the wheel Add LICENSE.txt Update doc/paralle.rst [MRG+1] Remove all nose imports from test scripts. (joblib#422) ...
Second Phase PR on #411 ( Succeeding PR #422 )
Native Python ships
exceptionsmodule which has an implementation ofAssertionError. This exception is raised when any statement usingassertkeyword is incorrect. When the tests are run withpy.test, this is overriden by_pytest.assertion.reinterpret.AssertionError.Hence instead of using
assert_true,assert_false,assert_equalandassert_not_equalmethods, usingassertkeyword statements provides a helpful error log for debugging upon failing tests usingpy.testcommand.Besides this, the replacement can be welcoming because:
Execution with py.test causes three tests to fail, which will be taken up just after this PR.