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

Use MagicMock for unit testing WorkbenchConfig.py #697

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ysuarez
Copy link
Contributor

@ysuarez ysuarez commented Oct 12, 2023

Link to Github issue or other discussion

#445

What does this PR do?

This is a simple refactor of the workbench config file unit tests to avoid using a redundant copy of code, and instead use a mock object.

What changes were made?

I replaced a redundant copy of the argparse logic used in the main workbench file with the use of unittest's MagicMock functionality. One reason is to reduce the risk of having a redundant copy of the argparse logic that may get out of sync in the future.

How to test / verify this PR?

Run this CLI command to test:
python3 tests/unit_tests_workbench_config.py -v

All tests should pass.

Interested Parties

@mjordan


Checklist

  • Before opening this PR, have you opened an issue explaining what you want to to do?
  • Have you run pycodestyle --show-source --show-pep8 --ignore=E402,W504 --max-line-length=200 yourfile.py?
  • Have you included some configuration and/or CSV files useful for testing this PR?
  • Have you written unit or integration tests if applicable?
  • Does the code added in this PR require a version of Python that is higher than the current minimum version?
  • If the changes in this PR require an additional Python library, have you included it in setup.py?
  • If the changes in this PR add a new configuration option, have you provided a default for when the option is not present in the .yml file?

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.

1 participant