Closed lcerman closed 3 years ago
I have just found that the temp dirs are intentionally not removed by the poolRunner when the Python 3 is detected. Also found one older attempt to fix this here #173.
If that is problem of macOS why not narrow the condition skipping temp removal for macOS only? Leaving thousands of empty temp directories after multiple runs of the tests is somewhat annoying...
@lcerman It's extremely annoying. Unfortunately, it's also disturbingly hard to fix. I've spent days on this in the past. Take a look at what happens if I just try to naively clean up files and ignore errors --> 💥 ... and not just on macOS.
Perhaps it just needs a fresh pair of eyes! Would you like to give it a try? We all have our blind spots, so maybe you'll find a way that I missed. If you fork and make a PR, any commit you push to your fork should trigger CI on TravisCI and AppVeyor so you can see whether anything breaks or not.
Finally, I am back with a solution: https://github.com/CleanCut/green/pull/232
The solution is pragmatic -- rather than trying to remove the temp-dirs in the workers a single temp-dir is created by the main function. The workers continue to create their own temps as sub-directories of the main temp, which is then removed when the main function finishes.
Awesome! Thank you so much. That's a nice solution.
The fix is included in 3.2.3, just released.
After running green an empty tmpdir remain in /tmp for each test file executed. E.g., if I have project with 10 test files, 10 empty directories remains after running green. In a larger project it soon reaches thousands of empty directories in tmp after a while...
Steps to reproduce:
class Test(unittest.TestCase): def test(self): pass
verbose = 2 file-pattern = _test.py omit-patterns = _test.py
$ green --version Green 3.2.0, Coverage 5.1, Python 3.7.5