pytest-dev / py

Python development support library (note: maintenance only)
MIT License
67 stars 106 forks source link

Don't create link in make_numbered_dir #194

Closed anxuae closed 2 years ago

anxuae commented 6 years ago

It it possible to make optional the link creation et the end of the method make_numbered_dir?

Using the option --basetemp with pytest has the consequence to create a link to each temporary directory, thus double the quantity of folders and let the temp directory less readable.

RonnyPfannschmidt commented 6 years ago

please report this against pytest as well, we want to remove using make_numbered_dir in near future

0cjs commented 6 years ago

What timing. I start pytest with --basetemp=my-repo/.build/pytest/tmp, and I just sat down finally to figure out why I was getting a my-current symlink just above my repo directory pointing down into my-repo/.build/pytest/tmp/....

It appears that the symlink creation code at the end of make_numbered_dir() function assumes that the prefix argument will end in a hyphen (like the default value session-), so that the following line will be able to search backwards from the end of the path to find that hyphen:

dest = src[:src.rfind('-')] + '-' + username

(In my case username is current because neither USER nor USERNAME is set in my environment.)

I'm not clear on the exact details of how pytest calls make_numbered_dir, but I expect that when using the default basetemp pytest passes in a prefix with a hyphen in it (probably pytest- or something ending with that) but does not do so when the --basetemp option is given.

My workaround for this is to start pytest with --basetemp=my-repo/.build/pytest/tmpdir-top, which causes the symlink to appear in my-repo/.build/pytest.

Is py going to keep make_numbered_dir around? If it's not going to be removed soon, I guess the bug should probably be fixed so that other clients don't run in to a similar problem.

RonnyPfannschmidt commented 6 years ago

i plan to port pytests normcase handling to pathlib2 in the near future as for py - at least i am no longer working on maintaining it

RonnyPfannschmidt commented 2 years ago

closing as wontfix - pytest no longer uses py.path.local for numbered dirs