diff options
Diffstat (limited to 'test/test_sources.py')
-rw-r--r-- | test/test_sources.py | 47 |
1 files changed, 36 insertions, 11 deletions
diff --git a/test/test_sources.py b/test/test_sources.py index 0437511..29c19a3 100644 --- a/test/test_sources.py +++ b/test/test_sources.py @@ -1,16 +1,41 @@ -import os +import pytest +from rpmlint.checks.SourceCheck import SourceCheck +from rpmlint.filter import Filter -import SourceCheck -import Testing +from Testing import CONFIG, get_tested_package -class TestSourceCheck(Testing.OutputTest): +@pytest.fixture(scope='function', autouse=True) +def sourcescheck(): + CONFIG.info = True + output = Filter(CONFIG) + test = SourceCheck(CONFIG, output) + return output, test - @classmethod - def setup_class(cls): - cls.check = SourceCheck.check.check - def test_inconsistent_file_extension(self): - for package in ['wrongsrc']: - out = self._rpm_test_output(os.path.join('source', package)) - assert 'inconsistent-file-extension' in "\n".join(out) +@pytest.mark.parametrize('package', ['source/wrongsrc']) +def test_extension_and_permissions(tmp_path, package, sourcescheck): + output, test = sourcescheck + test.check(get_tested_package(package, tmp_path)) + out = output.print_results(output.results) + + assert len(output.results) == 1 + + assert 'inconsistent-file-extension' in out + assert 'name extension indicates a different compression format' in out + + assert 'strange-permission' not in out + assert 'a file should have' not in out + + +@pytest.mark.parametrize('package', ['source/not-compressed-multi-spec']) +def test_compression_and_multispec(tmp_path, package, sourcescheck): + output, test = sourcescheck + test.check(get_tested_package(package, tmp_path)) + out = output.print_results(output.results) + + assert 'source-not-compressed' in out + assert 'source archive or file in your package is not compressed' in out + + assert 'multiple-specfiles' in out + assert 'package contains multiple spec files' in out |