import os
import pytest
import shutil
import tempfile

@pytest.fixture(scope="module")
def repotree(request):
    # Create a basic skeleton repository with "Release" files to sign.
    top_dir = tempfile.mkdtemp(suffix='.merfi')
    # Top directories:
    os.mkdir(os.path.join(top_dir, 'db'))
    os.mkdir(os.path.join(top_dir, 'dists'))
    os.mkdir(os.path.join(top_dir, 'pool'))
    # Distro "Release" files:
    for distro in ['precise', 'trusty']:
        distro_dir = os.path.join(top_dir, 'dists', distro)
        os.mkdir(distro_dir)
        release_file = open(os.path.join(distro_dir, 'Release'), 'w')
        release_file.write('some Release metadata for %s' % distro)
        release_file.close()

    def fin():
        shutil.rmtree(top_dir)
    request.addfinalizer(fin)
    return top_dir

@@ -48,16 +48,363 @@
 mpfile%0A%0A
+# TODO: Enhance this fixture so that we distinguish between the %22Release%22%0A# files that need to be signed and the ones that do not.%0A#   - Create more bogus %22Releases%22 files that don't need to be signed.%0A#   - Write a line %22SHA256:%22 into the correct %22Releases%22 file that *should* be%0A#     signed.%0A# See https://github.com/alfredodeza/merfi/issues/6%0A
 @pytest.

add comment about signing specific "Release" files