Description
Running the test suite on main currently yields a warning:
RuntimeWarning: 'bandscope_analysis.cli' found in sys.modules after import of package 'bandscope_analysis', but prior to execution of 'bandscope_analysis.cli'; this may result in unpredictable behaviour
Other deprecation warnings (librosa, audioread) were addressed in separate feature branches (PR #149). This issue tracks fixing the remaining root causes of runtime warnings during pytest execution.
Root Cause Analysis
- The
RuntimeWarning is caused by testing runpy.run_module against a module that is already imported at the top of the test file (test_cli.py). Python's runpy issues a warning when doing this because running an already-imported module as __main__ can cause side effects.
Action Plan
- Refactor the test or the import logic in
test_cli.py to eliminate the RuntimeWarning.
- Ensure all tests run with 0 warnings on the default branch.
Description
Running the test suite on
maincurrently yields a warning:RuntimeWarning: 'bandscope_analysis.cli' found in sys.modules after import of package 'bandscope_analysis', but prior to execution of 'bandscope_analysis.cli'; this may result in unpredictable behaviourOther deprecation warnings (librosa, audioread) were addressed in separate feature branches (PR #149). This issue tracks fixing the remaining root causes of runtime warnings during pytest execution.
Root Cause Analysis
RuntimeWarningis caused by testingrunpy.run_moduleagainst a module that is already imported at the top of the test file (test_cli.py). Python'srunpyissues a warning when doing this because running an already-imported module as__main__can cause side effects.Action Plan
test_cli.pyto eliminate theRuntimeWarning.