diff --git a/blag/version.py b/blag/version.py index 5726675..b282d03 100644 --- a/blag/version.py +++ b/blag/version.py @@ -1 +1 @@ -__VERSION__ = '0.0.6' +__VERSION__ = '0.0.7' diff --git a/tests/conftest.py b/tests/conftest.py index 221f0af..221078c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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 diff --git a/tests/test_blag.py b/tests/test_blag.py index b50af7f..c4e19a6 100644 --- a/tests/test_blag.py +++ b/tests/test_blag.py @@ -7,13 +7,13 @@ import pytest from blag import blag -def test_generate_feed(args): +def test_generate_feed(cleandir): articles = [] - blag.generate_feed(articles, args.output_dir, ' ', ' ', ' ', ' ') - assert os.path.exists(f'{args.output_dir}/atom.xml') + blag.generate_feed(articles, 'build', ' ', ' ', ' ', ' ') + assert os.path.exists('build/atom.xml') -def test_feed(args): +def test_feed(cleandir): articles = [ [ 'dest1.html', @@ -34,9 +34,9 @@ def test_feed(args): ] - blag.generate_feed(articles, args.output_dir, 'https://example.com/', + blag.generate_feed(articles, 'build', 'https://example.com/', 'blog title', 'blog description', 'blog author') - with open(f'{args.output_dir}/atom.xml') as fh: + with open('build/atom.xml') as fh: feed = fh.read() assert '