Replies: 1 comment 3 replies
-
i believe sucha hierarchy can be mirrored by fixture parameters and dependences
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I have a Python script (HiPhish /
anno-1503-resolution-patcher) which patches a DLL file from a game (Anno 1503) to run at higher resolutions. There is some guesswork involved, so the patcher produces multiple files per resolution. I am using Pytest to run an end-to-end test which calls the patcher and then compares the generated files to manually created files for equality.
Here is what I am trying to achive: I want to run the patcher once per resolution, but run the test once per generated file. My current test looks like this:
The fixture
invocation
is parameterized throughwidth
andheight
by the resolution and is run before each test. The test itself is parameterized on the resolution (throughpatch_path
) and the name of the file to check (throughfname
). So in total the test is run for each resolution and each file. This is fine. However, I do not want to runinvocation
for each combination for resolution and file name, I only want to run it once per resolution.The only solution I have found is to set the scope of all fixtures to
session
. This will cause Pytest to run fixtures only when it needs to. Is this the correct way? I seems very hacky, like I'm abusing the purpose of the scope.Beta Was this translation helpful? Give feedback.
All reactions