Skip to content

Conversation

vytas7
Copy link
Contributor

@vytas7 vytas7 commented May 12, 2025

See the discussion on the issue (#3512) for the detailed explanation of the problem.

Fixes #3512.

  • ran the linter to address style issues (tox -e fix)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added news fragment in docs/changelog folder
  • updated/extended the documentation

Copy link
Member

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need a test and a changelog here 👍

@vytas7
Copy link
Contributor Author

vytas7 commented May 13, 2025

Thanks for taking a look at this @gaborbernat!

The question remains though what we should do with #3512? Should we leave it open?

What would the correct fix be for the case of the builder's root actually being reconfigured to another path, and in which scenario can this happen?

@vytas7
Copy link
Contributor Author

vytas7 commented May 13, 2025

OK, I'll link the newsfragment to this PR, leaving the issue as-is for now.

Copy link
Contributor Author

@vytas7 vytas7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gaborbernat I need help on the tests.
I tried to transplant my MRE from the issue into the test suite, and it seems to work just fine, however, if I deliberately reintroduce the bug, it still passes. 🤔

I verified that a new backend executor is created in that case, however, that doesn't seem to cause any issues, unlike in the real run.

"""
sdist = pkg_with_pdm_backend / "dist" / "skeleton-0.1.1337.tar.gz"
proj = tox_project({"tox.ini": tox_ini}, base=pkg_with_pdm_backend)
result = proj.run("--installpkg", str(sdist), "--exit-and-dump-after", "10")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This --exit-and-dump-after should be increased to something larger (like 120) once I iron out the tests.

@vytas7 vytas7 requested a review from gaborbernat May 15, 2025 16:17
@gaborbernat
Copy link
Member

Seems this stalled 🤔

@gaborbernat gaborbernat closed this Sep 2, 2025
@gaborbernat gaborbernat reopened this Sep 2, 2025
@vytas7
Copy link
Contributor Author

vytas7 commented Sep 2, 2025

Hi @gaborbernat!
it has not stalled per se, I'm happy to help, but I'm not sure how to write a meaningful test.

The patch itself works for us, and we use it internally at work (hosting a custom post-release of tox on our internal Devpi).

There is my reproducer on #3512 that I tried to transplant into the test suite, but for some reason I cannot reproduce it therein, only when running Tox "normally".

Maybe I could try to take a look at writing a non-functional, unit-test like, test, just mocking Python attributes?

@gaborbernat
Copy link
Member

Can you fix the CI?

@vytas7
Copy link
Contributor Author

vytas7 commented Sep 2, 2025

Can you fix the CI?

I don't remember what was wrong there, I can take a fresh look. But IIRC my attempt at running the said "functional" test passed but caused the CI gates to crash or hang for some reason that I didn't understand either.

As said, I can also try to write more a unit-test like case unless you could point me to an example how to write a "functional" test running a real process. I saw that some tests did that but I don't understand the difference or the proper way to implement it.

@gaborbernat
Copy link
Member

We'd need to get the CI passing as is before we can think of adding more tests 🤔

@vytas7
Copy link
Contributor Author

vytas7 commented Sep 2, 2025

@gaborbernat to sum up, I believe my fix does what it should, and my fixture pkg_with_pdm_backend does recreate the example. What is the canonical way to run that with tox as a "functional" test in the suite?

@gaborbernat
Copy link
Member

We don't have functional tests, just integration tests, there are examples of that in the suite 🤔

@vytas7
Copy link
Contributor Author

vytas7 commented Sep 2, 2025

Aha, thanks, I'll take a look. Maybe my attempt to --exit-and-dump-after as a safeguard eventually kills the suite itself? 🤔

@vytas7 vytas7 marked this pull request as ready for review September 2, 2025 16:22
@vytas7
Copy link
Contributor Author

vytas7 commented Sep 2, 2025

@gaborbernat that seemed to be the case, I removed that safeguard, and the suite now ostensibly passes just fine.

To be precise in good faith though, IIRC my proposed regression test did not catch the issue even if I undid the fix. Probably there are subtle differences between running tox standalone vs via integration tests. I'll recheck.

Or maybe it is good enough for now? Cause I don't know how to reproduce this in tests short of a "functional" run.

@vytas7 vytas7 requested a review from gaborbernat September 2, 2025 19:10
@vytas7 vytas7 changed the title Work around Tox hanging with --installpkg sdist due to orphaned build backend Prevent Tox from hanging with --installpkg sdist due to orphaned build backend Sep 3, 2025
@gaborbernat gaborbernat merged commit 9ea1c32 into tox-dev:main Sep 3, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tox hangs on waiting for pyproject_api backend if --installpkg is used

2 participants