-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add support for 'pytest' #249
Conversation
Move "test/{build => buildd}" (pytest ignores 'build' by default) Copy 'example_project' to temp dir before each test Minor refactoring
mkdir(test_project_dir_path / '.dags') | ||
(test_project_dir_path / '.dags' / 'leftover').touch() | ||
|
||
|
||
def dags_leftovers_exist(test_project_dir_path: Path = TEST_PROJECT_PATH): | ||
def dags_leftovers_exist(test_project_dir_path=None): |
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.
Why?
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.
Now 'TEST_PROJECT_PATH' is different for each test (tmp directory) and redefined in TestCase.setUp
@@ -31,7 +31,7 @@ class _BaseBuildReflectTest( | |||
mixins.PrototypedDirMixin, | |||
unittest.TestCase, | |||
): | |||
proto_dir = "build/bf-projects/bf_selfbuild_project" | |||
proto_dir = "buildd/bf-projects/bf_selfbuild_project" |
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.
why buildd instead of build?
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.
'pytest' ignores 'build' and 'dist' directories by default. pytest-dev/pytest#1544
It might be "fixed" by redefining configuration for pytest in pyproject.toml OR by renaming directories.
Minor test refactoring, fix some tests:
python -m unittest
still works.To run pytest:
Test runner supports many nice features: printing logs
--log-cli-level=DEBUG
, printing local variables--showlocals
, auto pdb--pdb
etc. More details here: https://docs.pytest.org/en/stable/usage.html