-
Notifications
You must be signed in to change notification settings - Fork 18
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
Egork/vila unitet test to class #169
Conversation
Hey @comorado, I am not sure if it recommended to move directories during testing: I can imagine introducing a bug during tests that is caused by a previous test moving to a different directory. In tests I've authored, I use Some StackOverflow answers recommend creating functions pointing to paths and decorating them with |
Good point @soldni, that's the reason why I had it in setUp method. setUp is run prior to running each individual test https://stackoverflow.com/questions/6854658/explain-the-setup-and-teardown-python-methods-used-in-test-cases
A bit too fancy, thank you for the pointer :) |
@soldni I've pushed a commit where I am creating a path variable. Still doing it though in the setUp method. On the pytest run time each individual test receives it's version of the setUp variables. So for example if self.doc was modified in one test, another test is not going to see the modifications because it receives its version of the self.doc created by the setUp class. |
bfa5108
to
a425583
Compare
… specify it in pytest.ini
… and coverage reporting tool
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.
I don't know if I found them all, but suggested a few places where you can use pathlib
's /
syntax to join paths. From
import os
from pathlib import Path
path = Path('path/to/dir')
os.path.join(path, 'subpath/to/file.txt')
to
from pathlib import Path
path = Path('path/to/dir')
path / 'subpath/to/file.txt'
saves you an import and it's easier to read!
I've also left a comment about unifying dev
and test
dependency groups.
Co-authored-by: Luca Soldaini <lucas@allenai.org>
Co-authored-by: Luca Soldaini <lucas@allenai.org>
Co-authored-by: Luca Soldaini <lucas@allenai.org>
Co-authored-by: Luca Soldaini <lucas@allenai.org>
Co-authored-by: Luca Soldaini <lucas@allenai.org>
Co-authored-by: Luca Soldaini <lucas@allenai.org>
Co-authored-by: Luca Soldaini <lucas@allenai.org>
Co-authored-by: Luca Soldaini <lucas@allenai.org>
Co-authored-by: Luca Soldaini <lucas@allenai.org>
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.
lgtm!
Moving unite tests to the class. Locally pytest test would fail on this file