Skip to content

python 3.14: fix canfail related tests#51697

Merged
alalazo merged 1 commit intodevelopfrom
hs/fix/test-canfail-no-env-variables
Dec 8, 2025
Merged

python 3.14: fix canfail related tests#51697
alalazo merged 1 commit intodevelopfrom
hs/fix/test-canfail-no-env-variables

Conversation

@haampie
Copy link
Copy Markdown
Member

@haampie haampie commented Dec 5, 2025

The tests that rely on canfail to fail dynamically are broken under a
forkserver multiprocessing strategy, because the environment variables set in
the parent process are not inherited by the subprocess of the installer (at least
not the second invocation after changes in the parent process).

We can just use attributes because the package is serialized in case of spawn
and forkserver (and obvsly it works with forking).

However, the amazing spack builder logic caches the builder per package
instance, and the builder copies the package's __dict__, meaning we have to
force that cache to be cleared after mutating a package property. That's likely
the reason environment variables were used.

@haampie haampie added v1.1.0 PRs to backport for v1.1.0 v1.0.3 PRs to backport for v1.0.3 labels Dec 5, 2025
@haampie haampie changed the title tests: fix canfail package tests: fix canfail related tests under forkserver Dec 5, 2025
@haampie haampie changed the title tests: fix canfail related tests under forkserver python 3.14: fix canfail related tests Dec 5, 2025
* Use an attribute instead of environment variables to make the package
  fail to build. This fixes a problem when using forkserver as a
  multiprocessing start method, which does not inherit the environment
  variable changes, unlike fork and spawn.
* Fix the tests which assumed the `canfail` package would fail without
  telling it to. The tests passed because a previous test would set an
  environment variable in the current process. Oops.

Signed-off-by: Harmen Stoppels <[email protected]>
@haampie haampie force-pushed the hs/fix/test-canfail-no-env-variables branch from 10dc488 to c04d069 Compare December 5, 2025 16:45
@alalazo alalazo self-assigned this Dec 8, 2025
@alalazo alalazo merged commit 8ca0187 into develop Dec 8, 2025
33 of 34 checks passed
@alalazo alalazo deleted the hs/fix/test-canfail-no-env-variables branch December 8, 2025 08:28
@becker33 becker33 mentioned this pull request Feb 2, 2026
becker33 pushed a commit that referenced this pull request Feb 2, 2026
* Use an attribute instead of environment variables to make the package
  fail to build. This fixes a problem when using forkserver as a
  multiprocessing start method, which does not inherit the environment
  variable changes, unlike fork and spawn.
* Fix the tests which assumed the `canfail` package would fail without
  telling it to. The tests passed because a previous test would set an
  environment variable in the current process.

Signed-off-by: Harmen Stoppels <[email protected]>
becker33 pushed a commit that referenced this pull request Feb 2, 2026
* Use an attribute instead of environment variables to make the package
  fail to build. This fixes a problem when using forkserver as a
  multiprocessing start method, which does not inherit the environment
  variable changes, unlike fork and spawn.
* Fix the tests which assumed the `canfail` package would fail without
  telling it to. The tests passed because a previous test would set an
  environment variable in the current process.

Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Gregory Becker <[email protected]>
becker33 pushed a commit that referenced this pull request Feb 19, 2026
* Use an attribute instead of environment variables to make the package
  fail to build. This fixes a problem when using forkserver as a
  multiprocessing start method, which does not inherit the environment
  variable changes, unlike fork and spawn.
* Fix the tests which assumed the `canfail` package would fail without
  telling it to. The tests passed because a previous test would set an
  environment variable in the current process.

Signed-off-by: Harmen Stoppels <[email protected]>
Signed-off-by: Gregory Becker <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v1.0.3 PRs to backport for v1.0.3 v1.1.0 PRs to backport for v1.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants