Closed cclauss closed 4 years ago
The way that testing is done in Python is that the file under test is imported (by doctest, unittest, pytest, etc.) and then tests are run on it. If there is blocking code that is in global scope then the import operation fails and the tests can never be started. While #2 is an extremely simple test, it adequately demonstrates that no tests can be run with so much code (460+ lines) being run at a global scope. We will need to put that code into functions or indent it under if __name__ == "__main__":
so that it is not run when filterCSV
is imported.
Closed by #2.
Python code should be in functions or indented under
if __name__ == "__main__":
to allow doctests (#2), unittests, pytests, etc. to run. This needs to be done so that the test in #2 can run successfully. Once this is done, we can create separate test files that can be executed via pytest.