rdossant / modularity / fedmod

Forked from modularity/fedmod 5 years ago
Clone

e6ae613 change back out of temporary directory after test

Authored and Committed by nphilipp 5 years ago
    change back out of temporary directory after test
    
    Otherwise, that the testing process is in a temporary directory which
    doesn't exist anymore can trigger an internal error in pytest which
    causes subsequent tests not to be run.
    
    Additionally, use a context manager to clean up the temporary directory.
    
    Here's what the error looks like:
    --- 8< ---
    INTERNALERROR> Traceback (most recent call last):
    INTERNALERROR>   File "<frozen importlib._bootstrap>", line 888, in _find_spec
    INTERNALERROR> AttributeError: 'AssertionRewritingHook' object has no attribute 'find_spec'
    INTERNALERROR>
    INTERNALERROR> During handling of the above exception, another exception occurred:
    INTERNALERROR>
    INTERNALERROR> Traceback (most recent call last):
    INTERNALERROR>   File "/home/nils/.virtualenvs/fedmod/lib/python3.6/site-packages/_pytest/main.py", line 178, in wrap_session
    INTERNALERROR>     session.exitstatus = doit(config, session) or 0
    [...]
    INTERNALERROR>   File "/home/nils/.virtualenvs/fedmod/lib/python3.6/site-packages/py/_path/local.py", line 158, in __init__
    INTERNALERROR>     self.strpath = abspath(path)
    INTERNALERROR>   File "/home/nils/.virtualenvs/fedmod/lib64/python3.6/posixpath.py", line 376, in abspath
    INTERNALERROR>     cwd = os.getcwd()
    INTERNALERROR> FileNotFoundError: [Errno 2] No such file or directory
    --- >8 ---
    
        
file modified
+26 -25