replaced args with cleandir where possible, removed tempdir

This commit is contained in:
Bastian Venthur
2021-03-29 13:17:40 +02:00
parent 499b0dfe11
commit 9cdecdccf7
4 changed files with 28 additions and 28 deletions

View File

@@ -44,7 +44,10 @@ def tag_template(environment):
@pytest.fixture
def tempdir():
def cleandir():
"""Create a temporary workind directory and cwd.
"""
config = """
[main]
base_url = https://example.com/
@@ -58,15 +61,12 @@ author = a. u. thor
os.mkdir(f'{dir}/{d}')
with open(f'{dir}/config.ini', 'w') as fh:
fh.write(config)
# change directory
old_cwd = os.getcwd()
os.chdir(dir)
yield dir
@pytest.fixture
def cleandir(tempdir):
old_cwd = os.getcwd()
os.chdir(tempdir)
yield
os.chdir(old_cwd)
# and change back afterwards
os.chdir(old_cwd)
@pytest.fixture