-
Notifications
You must be signed in to change notification settings - Fork 21
Reorganized test files to match src folder structure #171
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
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #171 +/- ##
==========================================
- Coverage 99.17% 99.17% -0.01%
==========================================
Files 7 7
Lines 243 242 -1
==========================================
- Hits 241 240 -1
Misses 2 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.
few inlines
tests/conftest.py
Outdated
|
||
def _load(filename): | ||
return "tests/testdata/" + filename | ||
return str(base_path / filename) |
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.
is there a reason you return a string and not the Path object?
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 was trying to match the original return of strings but the Path object also works, will edit to just return the Path object
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.
This work is exactly what Path
is designed for.
|
||
def test_load_multiple(tmp_path, datafile): | ||
# Load test data | ||
targetjson = datafile("targetjson.json") | ||
generatedjson = tmp_path / "generated_serialization.json" | ||
|
||
tlm_list = os.listdir(os.path.join(tests_dir, "testdata", "dbload")) | ||
tlm_list.sort() | ||
dbload_dir = os.path.dirname(datafile("dbload/e1.gr")) |
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.
then do these two lines using pathlib and pathlib globing?
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.
Yep, will use pathlib for both parts
generated_data = None | ||
for hfname in tlm_list: | ||
# gather data using loadData | ||
headerfile = os.path.normpath(os.path.join(tests_dir, "testdata", "dbload", hfname)) | ||
headerfile = os.path.join(dbload_dir, hfname) |
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.
and here.
@sbillinge Ready for review |
Much nicer, thanks! |
closes #160
@sbillinge pytest passed, ready for review