-
Notifications
You must be signed in to change notification settings - Fork 12
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
Version adapter and test fixes #186
Version adapter and test fixes #186
Conversation
- new adapter added to common_types that can read a version number, and optionally validate it against an integer, string or tuple(int, int, int) - applied this to all formats using version strings - fixed a bug where standard_format.game_model would ignore the name and version passed to it - fixed a bug where the bmssd tests wouldn't run
- added parse/build of dread .bmdefs (standard format) - added functions to dread_data and samus_returns_data to get a list of all files ending in an extension - applied this change to all tests that were using list comp to do this already - fixed some tests that were only testing a subset of the total files
- removed test_lib functions that operate on only files, since the FileTreeEditor can handle these - added a parse_build_compare_editor_parsed function that compares a parsed file to its rebuilt and reparsed contents - added/simplified some checks to skip missing files
for more information, see https://pre-commit.ci
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #186 +/- ##
==========================================
+ Coverage 74.70% 75.11% +0.41%
==========================================
Files 66 66
Lines 3277 3311 +34
==========================================
+ Hits 2448 2487 +39
+ Misses 829 824 -5 ☔ View full report in Codecov by Sentry. |
tests/formats/test_bmsld.py
Outdated
@@ -30,8 +31,11 @@ | |||
def surface_bmsld(samus_returns_tree) -> Bmsld: | |||
return samus_returns_tree.get_parsed_asset(all_bmsld[0], type_hint=Bmsld) | |||
|
|||
@pytest.mark.parametrize("bmsld_path", all_bmsld) | |||
@pytest.mark.parametrize("bmsld_path", samus_returns_data.all_files_ending_with(".bmsld")) |
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.
Delete all_bmsld then
tests/formats/test_pkg.py
Outdated
) | ||
@pytest.mark.parametrize("pkg_path", dread_data.all_files_ending_with(".pkg")) | ||
def test_compare_dread(dread_file_tree, pkg_path): | ||
parse_build_compare_editor(Pkg, dread_file_tree, pkg_path) |
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'd rather the Pkg tests not use the FileTreeEditor, because that one uses Pkg a lot internally
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.
There's a lot more of tests that automatically skip for missing files. Is there a way to know which of the file names we expect to be missing from the romfs? Because I'd prefer to fail a test if the file happens to be missing.
I can add lists of missing files to check against, will take a minute though |
- files are now checked against a list of files expected to be missing before a test is skipped - removed a duplicate bmmap test and changed test_minimap.py to test_bmmdef.py - test_pkg retains old behavior of not using FileTreeEditor
tests/formats/test_bmssd.py
Outdated
) | ||
@pytest.mark.parametrize("bmssd_path", samus_returns_data.all_files_ending_with(".bmssd")) | ||
def test_compare_msr(samus_returns_tree, bmssd_path): | ||
if bmssd_path in sr_missing: |
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.
Can you exclude the path from the parametrize, instead of skipping the test? Should make it cleaner overall with less skipped tests, plus be faster.
- added an optional list[str] arg "exclusions" to all_files_ending_with - parametrized test args now use this field to exclude missing files from parametrization, resulting in no skipped tests
c1c2846
to
cdd84c7
Compare
for more information, see https://pre-commit.ci
Fixes #30
Fixes #184
Added an adapter that converts a standard version field (Int16ul major, Int8 minor, Int8 patch) to a tuple or string "M.m.p" and optionally validates it against an expected version. This is applied to all places where a version field exists.
Fixed a bug where standard_format.game_model ignores the provided name and version field passed to it. Additionally, standard_format.create uses the new VersionAdapter.
Added parse/build for Dread .BMDEFS using a standard_format
Added a function to dread_data and samus_returns_data to return all files with a specified file extension. Replaces a large amount of code in test parametrization
Fixed some tests that were only testing on a subset of files (Bmssd, Bmbls, Bctex)
Fixed BCTEX skipping textures in packages
Removed test_lib functions that operate only on romfs files, since using the FileTreeEditor will cover these files and any in the packages
Added/simplified some checks to skip missing files