diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2013-09-06 17:15:52 +0300 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-01-14 13:49:53 +0200 |
commit | 92a38f51b6f90106a8cbadca11cafab89ec5fad6 (patch) | |
tree | d8017606f9435a2c0a1dc3738f550b8eafc63b77 /tests | |
parent | d55f1137d800d44c8fad41ec21c37074d73b7e38 (diff) | |
download | git-buildpackage-92a38f51b6f90106a8cbadca11cafab89ec5fad6.tar.gz git-buildpackage-92a38f51b6f90106a8cbadca11cafab89ec5fad6.tar.bz2 git-buildpackage-92a38f51b6f90106a8cbadca11cafab89ec5fad6.zip |
rpm.SpecFile: support parsing spec as raw text data
Instead of reading from a file.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_rpm.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_rpm.py b/tests/test_rpm.py index 63c9e8c3..c4174665 100644 --- a/tests/test_rpm.py +++ b/tests/test_rpm.py @@ -147,6 +147,23 @@ class TestSpecFile(object): assert spec.name == 'gbp-test-native2' assert spec.orig_src is None + def test_parse_raw(self): + """Test parsing of a valid spec file""" + with assert_raises(NoSpecError): + SpecFile(None, None) + with assert_raises(NoSpecError): + SpecFile('filename', 'filedata') + + spec_filepath = os.path.join(SPEC_DIR, 'gbp-test.spec') + with open(spec_filepath, 'r') as spec_fd: + spec_data = spec_fd.read() + spec = SpecFile(filedata=spec_data) + + # Test basic properties + assert spec.specfile == None + assert spec.specdir == None + assert spec.name == 'gbp-test' + def test_update_spec(self): """Test spec autoupdate functionality""" # Create temporary spec file |