Skip to content
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

[BUG] Cleanup doesn't occur correctly if tests fail #229

Open
virtuald opened this issue Jan 28, 2024 · 1 comment
Open

[BUG] Cleanup doesn't occur correctly if tests fail #229

virtuald opened this issue Jan 28, 2024 · 1 comment
Labels

Comments

@virtuald
Copy link
Member

I think what's happening is that when pytest is processing the exception, the traceback holds references to local objects (including the robot) and so the robot and related objects (in some cases) are never fully freed, so when the hal handles and other things are cleared at the end of the test those objects are all orphaned. Several solutions come to mind:

  • find a pytest hook that runs when we need it to happen and use that instead of at the end of the robot fixture
  • Run the resets at the beginning of the next function instead
  • We can technically run each tests in a new process now since the CLI doesn't have to import the robot code.. that would not be ideal, but many of these sorts of issues might disappear.

I believe this is causing robotpy/robotpy-navx#30, but I don't have conclusive proof.

@virtuald virtuald added the bug label Jan 28, 2024
@auscompgeek
Copy link
Member

I think what's happening is that when pytest is processing the exception, the traceback holds references to local objects (including the robot) and so the robot and related objects (in some cases) are never fully freed, so when the hal handles and other things are cleared at the end of the test those objects are all orphaned.

I concur here.

We can technically run each tests in a new process now since the CLI doesn't have to import the robot code.

I've used pytest-forked previously, but that doesn't work on Windows.

Maybe it's time to solve #212 and use pytest-xdist?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

2 participants