Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3366 +/- ##
===========================================
- Coverage 91.68% 74.71% -16.97%
===========================================
Files 38 38
Lines 32241 32242 +1
Branches 5155 5155
===========================================
- Hits 29559 24090 -5469
- Misses 2346 7800 +5454
- Partials 336 352 +16
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
428857e to
dbf9835
Compare
jeromekelleher
left a comment
There was a problem hiding this comment.
LGTM. Can we add a unit test please, checking that the filename goes into the exception as expected, and validating what happens when we use something that doesn't have a name? (Although, it's not obvious to me how you could have a seekable stream that doesn't have a name, but we need to do due diligence here.)
You can pytest.skip for Python < 310.
@benjeffery shall we just ditch Python 3.10 altogether?
Thanks for taking a look, I've trying modifying the existing tests in test_utils.py. I could use some pointers on how to test the stream side of things, where should it go and how do you generally do this? |
|
I think we're going to drop 3.10 ASAP, so let's not worry about the failures on 3.10 CI (and we can remove the conditional at the top). The tests you have look good, updating the existing ones here is fine (although may not need to check the filename on every downstream check for FileFormatError (as that's not what most of the tests are about). Have a look at tests/test_fileobj.py for what happens in the stream case and see what kind of error messages we get. |
|
Thanks, reduced the number of tests of FileFormatError. In the TestBadStream, the error_text for matching does not seem to be used as modifying it to something that shouldn't be in the error does not fail the test. For instance: Still passes |
|
I've had a look at this and unfortunately it's really not worth bothering with until we drop Python 3.10 (which will be later this year when it's EOL'd by Python), as it's hard to emulate |
|
thanks for investigating |
|
Needs the regex in the test suite to escape windows filenames that often contain backslashes, e.g. should be |
Closes tskit-dev#2467 Uses the .add_note method of exception, introduced in Python 3.11. Also hardcodes the file name in the raised from exceptions for HDF5 or zip. Until 3.10 is EOF, needs the sys module.
|
@hyanwong Thanks I've just fixed it for the windows tests. |
99921bf to
bf37965
Compare
Closes #2467
Uses the .add_note method of exception, introduced in Python 3.11. Also hardcodes the file name in
the raised from exceptions for HDF5 or zip.
Until 3.10 is EOF, needs the sys module.
Description
Would fix #2467
I'll tidy up (changelog and linting) if you think this change is ok.
PR Checklist: