Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Pylint E1120 (no-value-for-parameter) violations and removes global ignore #1194

Merged
merged 4 commits into from
Nov 13, 2023

Conversation

matt-graham
Copy link
Collaborator

Part of #1181.

Removes if __name__ == "__main__" blocks from tests/test_enhanced_lifestyle.py and tests/test_rti.py test modules which call out to test functions to allow running the modules as scripts. In both cases the call signatures of the test functions called have changed and so running as a script would have raised an error. As in both files this has been the case for a while, I suspect this means no-one is regularly using this approach for running tests, and in general using pytest should be preferred anyway, so I've just removed these blocks altogether rather than trying to fix. We probably also want to update the wiki to remove the example test module skeleton to remove the corresponding if __name__ == "__main__" block.

Also refactors test_scale_run_script_deterministic in tests/test_determinism.py to avoid a Pylint E1120 false positive on unpacking final_population_dataframes list in to call to pandas.testing.assert_frame_equal which appears to be because it cannot determine the length of the list and so whether both the required left and right arguments to pandas.testing.assert_frame_equal will be passed values. An error message was previously being constructed alongside the call to pandas.testing.assert_frame_equal but nothing was actually being done with it, presumably as I initially wrote this as a plain assert statement intending the error message to be the optional message component of the statement, but then changed to using the pandas function instead at some point. The code has now been refactored to use a plain assert with pandas.DataFrame.equals which both avoids the false positive and ensures the error message will be correctly displayed.

Also fixes display of message on test failure as previously call to
pandas.testing.assert_frame_equal did not use message
@matt-graham matt-graham requested a review from tamuri November 13, 2023 15:32
@matt-graham matt-graham merged commit ebaf215 into master Nov 13, 2023
54 checks passed
@matt-graham matt-graham deleted the mmg/fix-pylint-e1120 branch November 13, 2023 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants