-
Notifications
You must be signed in to change notification settings - Fork 128
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
fix(tests): Fix false negative cram tests #1666
base: master
Are you sure you want to change the base?
Conversation
…ff_jsons.py invocations
…eshadfield @huddlej can you double check this is intended?
…ems to have caused no issues so far so likely ok
tests/functional/ancestral/data/ancestral_mutations_with_root_sequence.json
Outdated
Show resolved
Hide resolved
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.
# Test for most fatal errors in regex path usage | ||
# Exclude regexes should never match `'`, otherwise the diff is always going to pass |
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.
Should this include "
as well? I'm assuming root['generated_by']
and root["generated_by"]
are both valid.
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 think that the path that deep diff uses to match against uses a single quote not double quote. Hence excluding only single quote. Does that make sense?
parser.add_argument("--exclude-regex-paths", nargs="+", action="extend", help="list of path regular expressions to exclude from consideration when performing a diff") | ||
parser.add_argument("--ignore-numeric-type-changes", action="store_true", help="ignore numeric type changes in the diff (e.g., int of 1 to float of 1.0)") | ||
|
||
args = parser.parse_args() | ||
|
||
# Test for most fatal errors in regex path usage | ||
# Exclude regexes should never match `'`, otherwise the diff is always going to pass | ||
for regex in args.exclude_regex_paths or []: |
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.
nit
Adding or []
(e596b50) doesn't seem useful:
- We don't run mypy/pyright on this file
- A better solution would be to set
default=[]
onadd_argument()
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.
Just because we don't run mypy doesn't mean that we shouldn't prevent type errors from happening? The error actually happens irrespective of running mypy. It's not mypy erroring it's a real runtime error.
Why is changing the defaults better?
Co-authored-by: Victor Lin <13424970+victorlin@users.noreply.github.com>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1666 +/- ##
==========================================
+ Coverage 72.26% 72.29% +0.02%
==========================================
Files 79 79
Lines 8272 8276 +4
Branches 1691 1691
==========================================
+ Hits 5978 5983 +5
+ Misses 2009 2008 -1
Partials 285 285 ☔ View full report in Codecov by Sentry. |
This might be worth an internal changelog entry |
Description of proposed changes
diff_jsons.py
when exclude-regex-path is used incorrectly like in issue 1665 to prevent this issue from reoccurring silently["root['generated_by']", "root['meta']['updated']"]
instead of["root['generated_by']['version']"]
. This allows simplification of a lot of invocations ofdiff_jsons.py
and in turn reduces chance of errors similar to issue 1665. Anything withingenerated_by
can be ignored by cram tests,meta.updated
is only used in export, but no harm excluding by default as it isn't used in any other tests. If there's opposition, happy to revert that change.Checklist