def test_dataplugin_update_with_pytest_ini(testdir):
    testdir.makepyfile(PYTESTFILE)
    create_test_archive(testdir)
    testdir.makefile('ini', **{'pytest': ['[pytest]', 'dataplugin-signature =\n']})
    result = testdir.runpytest_subprocess('--dataplugin-upload')
    assert result.errlines == [
        'dataplugin upload invoked, skipping collection.',
        'Storing local archive: test-data.tar.gz',
        'Uploaded archive test-data.tar.gz with hash 2479d9203e1f4a326fd2cb49c66ab0904ebbd54c',
        'Signature updated, you may want to commit the changes too: pytest.ini',
    ]
def test_dataplugin_verify(testdir):
    testdir.makepyfile(PYTESTFILE)
    create_test_archive(testdir)
    testdir.makefile('ini', **{
            'pytest': [
                '[pytest]',
                'dataplugin-signature = 2479d9203e1f4a326fd2cb49c66ab0904ebbd54c\n'
            ]
        }
    )
    result = testdir.runpytest_subprocess('--dataplugin-verify')
    assert result.errlines == [
        'dataplugin verify invoked, skipping collection.',
        'Archive passed verification :)'
    ]
def test_dataplugin_fail_verify(testdir):
    testdir.makepyfile(PYTESTFILE)
    local_archive_files = {('txt', 'test-data-file'): 'test data content x'}
    create_test_archive(testdir, archive='.test-data.tar.gz', files=local_archive_files)
    testdir.makefile('ini', **{
            'pytest': [
                '[pytest]',
                'dataplugin-signature = 2479d9203e1f4a326fd2cb49c66ab0904ebbd54c\n'
            ]
        }
    )
    result = testdir.runpytest_subprocess('--dataplugin-verify')
    print_result(result)
    assert result.errlines == [
        'dataplugin verify invoked, skipping collection.',
        'Archive failed verification!'
    ]
    print_result(result)
示例#4
0
def test_dataplugin_download(testdir):
    testdir.makepyfile(PYTESTFILE)
    local_archive_files = {('txt', 'test-data-file'): 'test data content x'}
    remote_archive_files = {('txt', 'test-data-file'): 'test data content remote'}
    create_test_archive(testdir, archive='test-data.tar.gz', files=remote_archive_files)
    create_test_archive(testdir, archive='.test-data.tar.gz', files=local_archive_files)
    #create_test_archive(testdir)
    testdir.makefile('ini', **{
            'pytest': [
                '[pytest]',
                'dataplugin-signature = 2479d9203e1f4a326fd2cb49c66ab0904ebbd54c\n'
            ]
        }
    )
    result = testdir.runpytest_subprocess('--dataplugin-download')
    assert result.errlines == [
        'dataplugin download invoked, skipping collection.',
        'Storing local archive: test-data.tar.gz',
        'file downloaded',
    ]
def test_dataplugin_update_when_no_inifile(testdir):
    testdir.makepyfile(PYTESTFILE)
    create_test_archive(testdir)
    result = testdir.runpytest_subprocess('--dataplugin-upload')
    assert result.errlines[-1].startswith('No ini file configured.')