Closed madscatt closed 1 year ago
import unittest
instead of passing MockerTestCase to class X, pass unittest.TestCase
remove
from mocker import Mocker, MockerTestCase
also don't forget to use "with io.open" instead of open otherwise tests will return a ResourceWarning message.
add:
if name == 'main': (note that Markdown removes the double underscores around name and main here)
unittest.main()
to the end of all tests
Note: test_null for test_unit_calculate_Prop_calccom returned an error as numpy.zeros was called with float number of dimensions instead of int.
Note that import warnings ; warnings.filterwarnings('ignore') no longer works in global scope, needs to be in setUp method (see: test_unit_calculate_Prop_calccom.py). T
test_unit_calculate_Prop_calcpmi.py needs self.m = Mocker() to function
from unittest.mock import MagicMock
then for the specific mock in this specific file, since ARGS is not implemented in the same was as Mocker (2.7)
self.m = MagicMock() operate.Move.center(ARGS) needs to be operate.Move.center
Use python -m unittest discover to test all test_* files in a directory
656 tests converted to Python 3 ... all pass.
Mocker (python 2.7) had been replaced with Mock. Evaluate syntax and alter all tests so they work in Python 3.
Note, for now, we will write our tests using unittest as it is part of Python 3 and Pytest would be a non-standard, though widely used, dependency. Pytest does run the unittest code without modification.