-
Notifications
You must be signed in to change notification settings - Fork 22
Ignore autouse fixtures in conftest (CF-658) #268
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
Conversation
|
Closing it as renaming the conftest file could break testing for some repos as other fixtures would be defined there |
PR Reviewer Guide 🔍(Review updated until commit 677f0f8)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 677f0f8
Previous suggestionsSuggestions up to commit 1271f26
|
|
Looks like there are a few issues preventing this PR from being merged!
If you'd like me to help, just leave a comment, like
Feel free to include any additional details that might help me get this PR into a better state. You can manage your notification settings |
|
Persistent review updated to latest commit 677f0f8 |
tests/test_code_replacement.py
Outdated
|
|
||
| # Both fixtures should be modified | ||
| code = modified_module.code | ||
| assert code.count('if request.node.get_closest_marker("codeflash_no_autouse"):') == 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just compare with the actual full string
tests/test_code_replacement.py
Outdated
|
|
||
| code = modified_module.code | ||
| assert 'if request.node.get_closest_marker("codeflash_no_autouse"):' in code | ||
| assert "try:" in code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
full string
User description
Created a context manager for detecting and renaming the conftest.py file
PR Type
Enhancement, Tests
Description
Introduce AST-based modifiers for autouse fixtures
Apply
codeflash_no_autousemarker to all testsExtend CLI to set
override-fixturesand pytest markersRevert conftest changes after optimization
Changes walkthrough 📝
cmd_init.py
Initialize override-fixtures and pytest markerscodeflash/cli_cmds/cmd_init.py
tablefrom tomlkitoverride-fixturesflag in config[tool.pytest.ini_options].markerscode_replacer.py
Add AST transformers for pytest fixturescodeflash/code_utils/code_replacer.py
PytestMarkAdderandAutouseFixtureModifiertransformersdisable_autouse,modify_autouse_fixture,add_custom_marker_to_all_testslibcstandisortfor AST modificationsfind_conftest_filesandImportAddercode_utils.py
Add restore_conftest helpercodeflash/code_utils/code_utils.py
restore_conftestto revert conftest editsconfig_parser.py
Implement find_conftest_files functioncodeflash/code_utils/config_parser.py
find_conftest_filesto locate conftest.py per test pathfunction_optimizer.py
Integrate fixture modification into optimizercodeflash/optimization/function_optimizer.py
modify_autouse_fixtureinto optimize flowadd_custom_marker_to_all_testson generated tests