question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When using --target, exceptions can leave a temp directory behind

See original GitHub issue

Right, the problem with target_temp_dir is that it’s created conditionally - so sometimes it’s a context manager, and other times it’s None. So we can’t “just” enter it earlier, as you can’t do with None.

When we drop Python 2, we could fix this with contextlib.ExitStack. This isn’t worth vendoring the contextlib backport just for Python 2, though. We could also write our own MaybeContextManager class that wraps an optional context manager, but again that’s a lot of work.

I’m going to make the call that this should be handled in a follow-up PR, and for now just allow left-over temp directories in the test.

_Originally posted by @pfmoore in https://github.com/pypa/pip/pull/8462#issuecomment-649349135_

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
pfmoorecommented, Sep 2, 2020

@pfmoore, I think you’ve already fixed it in f162236 😄

I thought it rang a bell 😄

Too many issues in the tracker, not enough cells in my brain…

1reaction
uranusjrcommented, Sep 2, 2020

Gosh, I knew I’ve seen that CommandContextMixIn implementation before. I thought I was hallucinating or something.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working and unit testing with temporary files in Java
Because JUnit's rule deletes the temporary directory after each test method is run, you know that you're always starting with a fresh temporary...
Read more >
Supply Chain Labor & Human Rights Policies - Target Corporate
We do not allow exceptions, including those for temporary, migrant and contract workers. During the responsible sourcing audit, personnel records are reviewed ...
Read more >
"Exception has been thrown by the target of an invocation ...
I have a desktop app that loads assembly code via reflection then calls it via MethodInfo.Invoke(), it doesn't log exceptions to file, and...
Read more >
Snakefiles and Rules — Snakemake 7.19.1 documentation
Inside the shell command, all local and global variables, especially input and output files can be accessed via their names in the python...
Read more >
Configuration options for the dependabot.yml file - GitHub Docs
Detailed information for all the options you can use to customize how ... you use target-branch ), and specify a package-ecosystem and directory...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found