Closed ArtemErmulin closed 2 years ago
Hey Artem, I appreciate the contribution!
I'd like to suggest a different approach here. I strongly believe that mainline code should never have any logic just to help get the tests working - all test logic should be within the test code. Therefore I'm not happy with checking "PYTEST_CURRENT_TEST" in __main__.py
, or specifying "test.log" there.
I would suggest the following approach:
log_file=test.log
and log_file_level=debug
in pytest.ini
(see https://docs.pytest.org/en/latest/how-to/logging.html#live-logs)os.chdir(tmpdir)
in the sandbox
fixture (in tests/conftest.py
), so that logs written to "runtime.log" are within the sandbox and automatically get cleaned upHow does that sound, would you be happy to make those changes? This would be a great quality-of-life improvement for the project!
Merging #185 (f03bbfa) into dev (ffb5d4e) will increase coverage by
0.02%
. The diff coverage isn/a
.
@@ Coverage Diff @@
## dev #185 +/- ##
==========================================
+ Coverage 70.71% 70.74% +0.02%
==========================================
Files 38 38
Lines 3719 3719
==========================================
+ Hits 2630 2631 +1
+ Misses 1089 1088 -1
Impacted Files | Coverage Δ | |
---|---|---|
minegauler/shared/types.py | 86.87% <0.00%> (+0.62%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 0d9590d...f03bbfa. Read the comment docs.
Note that the branch to merge into is dev
, not the default main
branch - I've updated this for the PR, but you may wish to merge dev
into yours as it's slightly ahead of main
.
Thanks, Lewis!
I overreacted a little while solving this problem, sorry) Thanks for the tip, I didn't know that pytest has such functionality. One moment, I'll prepare the changes.
According to issue #162
Pytest environ variable
PYTEST_CURRENT_TEST
is used.