-
Notifications
You must be signed in to change notification settings - Fork 3
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
Simplify baseline names in snapshot testing #105
Conversation
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, only thought is if _get_samples()
could return something like:
{
"argvalues": [ ... ],
"ids": [....],
}
And then **-splat
it in the parameterize() call. Haven't tried, but that would make the naming/ordering local to _get_samples()
.
Purely from a typing standpoint, we'd need to return a similar but empty dict on the exception path for things to align, e.g., class Samples(TypedDict):
argvalues: list[Path]
ids: list[str]
def _get_samples() -> Samples:
# ...
try:
# ...
return {
"argvalues": samples,
"ids": [str(os.path.basename(s)) for s in samples],
}
except FileNotFoundError:
return {"argvalues": [], "ids": []} Would that look reasonable to you? |
2807210
to
c3ed33e
Compare
Could we ditch FileNotFound error? Most likely empty samples is not what one would want to test anyhow? I was thinking more about the following, but I'm now thinking your initial proposal with using
|
We previously would include a running number for the specific test parameterization in the snapshot for each sample test. This meant that tests could get renamed whenever a new sample was added. With this patch we now override the default name enumerating each parameterization and instead set it to the name of the sample a test runs on. With that snapshots should be much more stable.
c3ed33e
to
aabb000
Compare
Removed the handling of I agree that the coupling between the internals of |
We previously would include a running number for the specific test
parameterization in the snapshot for each sample test. This meant that
tests could get renamed whenever a new sample was added.
With this patch we now override the default name enumerating each
parameterization and instead set it to the name of the sample a test
runs on. With that snapshots should be much more stable.