
Hi Logan,
you are absolutely correct, I have found that interaction too - it is already fixed.
This is the commit af3ef4a27d82856 message:
fix import_file() for multiple imports
- the tests tests/test_input_linear_elastic_dynamic.py (1) and tests/test_input_linear_elastic.py (2) interacted, as (1) imports (2) and modifies some configuration (e.g. ebcs) - the test (2) then wrongly used the modified configuration as the module (2) was not reloaded
Look into sfepy/base/base.py at import_file() to see how to force a module reload.
This bug was rather tedious to track down on my slow old laptop - I even updated runTests.py to be able to run several selected tests together.
Thanks for pointing this out, as the bug did not manifest on my main computer.
r.
Logan Sorenson wrote:
Hi,
I think I identified the source of the problem. Basically, there is an unwanted interaction between tests/test_input_linear_elastic.py and tests/test_input_linear_elastic_dynamic.py. Since the test_input_linear_elastic_dynamic case is run first (at least on my machine) and input/linear_elastic_dynamic.py imports from input/linear_elastic.py, it looks like python is compiling linear_elastic.py -> linear_elastic.pyc for the linear_elastic_dynamic case, and then reusing that module when it imports again for the linear_elastic case. It picks up the ebcs as {'PerturbedSurface': ('Right', {'u.0': 'ebc_sin', 'u.1': 0.0, 'u.2': 0.0}), 'Fixed': ('Left', {'u.all': 0.0})} instead of the correct boundary conditions from linear_elastic.py, so it fails when it tries to find the ebc_sin function which no longer exists. Hope that is clear. :)
What would be the pythonic way to fix this? Is there a way to force python to recompile the input files when running tests?