summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2018-10-08 08:12:32 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2018-10-08 08:17:58 (GMT)
commit2414a1def4af92257638d8c2b28bdc4ee4cbe627 (patch) (side-by-side diff)
tree79ed3e5d23ea3681bd6ae7ebaebc106afad8030f
parent9966f4076b06902840d1253d2349d48653d6830d (diff)
downloadreleaselogparser-2414a1def4af92257638d8c2b28bdc4ee4cbe627.tar.gz
releaselogparser-2414a1def4af92257638d8c2b28bdc4ee4cbe627.tar.bz2
Add testsuite
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--.gitignore2
-rw-r--r--MANIFEST.in3
-rw-r--r--releaselog/input.py2
-rw-r--r--setup.py12
-rw-r--r--tests/__init__.py9
-rw-r--r--tests/rlogtester.py7
-rw-r--r--tests/test_cpan.py37
-rw-r--r--tests/test_gnu.py62
-rw-r--r--tests/test_python.py34
9 files changed, 160 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore
index 5f2763b..4dea9de 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
*~
*.pyc
-.emacs.desktop
+.emacs.*
build/
dist/
tmp/
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..268ee5b
--- a/dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,3 @@
+exclude .gitignore
+include COPYING.txt
+include CHANGES.txt
diff --git a/releaselog/input.py b/releaselog/input.py
index ebf8ab6..138ba16 100644
--- a/releaselog/input.py
+++ b/releaselog/input.py
@@ -30,7 +30,7 @@ class ReleaseLogFile(ReleaseLog):
class ReleaseLogURL(ReleaseLog):
- """Read history log entries from a URL file.
+ """Read history log entries from a URL.
Usage:
hist = ReleaseLogURL(fmt, url [, args...])
diff --git a/setup.py b/setup.py
index 9844af3..37a2b41 100644
--- a/setup.py
+++ b/setup.py
@@ -18,11 +18,11 @@
from setuptools import setup, find_packages
from codecs import open
-#with open("README.rst", "r") as fh:
-# long_description = fh.read()
+with open("README.rst", "r") as fh:
+ long_description = fh.read()
setup(name='releaselog',
- version='0.2',
+ version='0.3',
author='Sergey Poznyakoff',
author_email='gray@gnu.org',
url='http://git.gnu.org.ua/cgit/gsc/releaselog.git/',
@@ -31,10 +31,10 @@ setup(name='releaselog',
scripts=['bin/releaselog'],
license='GPL License',
description='Release log parser.',
-# long_description=long_description,
-# long_description_content_type="text/x-rst",
+ long_description=long_description,
+ long_description_content_type="text/x-rst",
platforms=['any'],
- # test_suite='tests',
+ test_suite='tests',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000..87f4c50
--- a/dev/null
+++ b/tests/__init__.py
@@ -0,0 +1,9 @@
+import unittest
+import sys
+from os.path import dirname, abspath
+
+sys.path.insert(0,dirname(abspath(__file__)))
+
+def test_suite():
+ loader = unittest.TestLoader()
+ return loader.loadTestFromModule()
diff --git a/tests/rlogtester.py b/tests/rlogtester.py
new file mode 100644
index 0000000..7e4b374
--- a/dev/null
+++ b/tests/rlogtester.py
@@ -0,0 +1,7 @@
+import unittest
+from releaselog import ReleaseLog
+
+class ReleaseLogTestCase(unittest.TestCase):
+ def setUp(self):
+ self.rlog = ReleaseLog(self.type, self.input.split("\n"),
+ **self.kwargs)
diff --git a/tests/test_cpan.py b/tests/test_cpan.py
new file mode 100644
index 0000000..b707c8d
--- a/dev/null
+++ b/tests/test_cpan.py
@@ -0,0 +1,37 @@
+from rlogtester import ReleaseLogTestCase
+
+class CPANReleseLogTestCase(ReleaseLogTestCase):
+ type = 'CPAN'
+ kwargs = { }
+ input = """
+Revision history for Perl extension Config::HAProxy.
+
+1.02 Mon Jul 16 07:38:31 2018
+ - remove the leftover use of autodie
+
+1.01 Thu Jul 12 09:04:28 2018
+ - set minimal required Perl version
+ - drop dependency on autodie
+
+1.00 Sun Jul 8 19:57:57 2018
+ - original revision
+
+0.05 2018-05-20
+ - experimental version
+"""
+ def test_count(self):
+ self.assertEqual(len(self.rlog), 4, "wrong count")
+
+ def test_recent(self):
+ elt = self.rlog[0]
+ self.assertEqual(elt.version, "1.02")
+
+ def test_index(self):
+ elt = self.rlog[2]
+ self.assertEqual(elt.version, "1.00")
+
+if __name__ == '__main__':
+ unittest.main()
+
+
+
diff --git a/tests/test_gnu.py b/tests/test_gnu.py
new file mode 100644
index 0000000..090949c
--- a/dev/null
+++ b/tests/test_gnu.py
@@ -0,0 +1,62 @@
+from rlogtester import ReleaseLogTestCase
+
+class GNUReleseLogTestCase(ReleaseLogTestCase):
+ type = 'GNU'
+ kwargs = { }
+ input = """
+GNU mailutils NEWS -- history of user-visible changes. 2018-08-29
+Copyright (C) 2002-2018 Free Software Foundation, Inc.
+See the end of file for copying conditions.
+
+Please send mailutils bug reports to <bug-mailutils@gnu.org>.
+
+Version 3.5.90 (Git)
+
+* Bugfixes
+
+Version 3.5, 2018-08-29
+
+* Support for Guile version 2.2.0 and later
+
+Support for prior versions has been withdrawn.
+
+* New scheme functions
+
+** mu-encoder-port port name . args
+
+Version 3.4 - 2017-11-02
+
+* Fix AM_MAILUTILS macro
+
+The macro incorrectly compared three-part version number with a
+two-part argument.
+
+Version 3.3 - Sergey Poznyakoff, 2017-10-18
+
+* TLS configuration
+
+Some changes to the TLS configuration
+
+Version 3.2 - 2017-03-11
+
+* configuration syntax
+
+Statements that allow for variable substitution also allow for command
+expansion. Commands are invoked the same way as in shell.
+"""
+
+ def test_count(self):
+ self.assertEqual(len(self.rlog), 4, "wrong count")
+
+ def test_recent(self):
+ elt = self.rlog[0]
+ self.assertEqual(elt.version, "3.5")
+
+ def test_index(self):
+ elt = self.rlog[2]
+ self.assertEqual(elt.version, "3.3")
+
+if __name__ == '__main__':
+ unittest.main()
+
+
diff --git a/tests/test_python.py b/tests/test_python.py
new file mode 100644
index 0000000..904cc82
--- a/dev/null
+++ b/tests/test_python.py
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+from rlogtester import ReleaseLogTestCase
+
+class PythonReleseLogTestCase(ReleaseLogTestCase):
+ type = 'python'
+ kwargs = { }
+ input = """
+v1.3, 2018-09-01 -- Don't throw exception on invalid tokens.
+ Fix python 3 compatibility
+v1.2, 2018-08-27 -- Fix handling of unrecognized closing tags.
+v1.1, 2018-08-24 -- Initialize token_class dynamically.
+v1.0, 2018-08-19 -- Initial release.
+
+"""
+
+ def test_count(self):
+ self.assertEqual(len(self.rlog), 4, "wrong count")
+
+ def test_recent(self):
+ elt = self.rlog[0]
+ self.assertEqual(elt.version, "1.3")
+
+ def test_index(self):
+ elt = self.rlog[2]
+ self.assertEqual(elt.version, "1.1")
+
+ def test_descr(self):
+ self.assertEqual('\n'.join(self.rlog[0].descr),"""Don't throw exception on invalid tokens.
+ Fix python 3 compatibility""")
+ self.assertEqual('\n'.join(self.rlog[2].descr),"Initialize token_class dynamically.")
+
+if __name__ == '__main__':
+ unittest.main()
+

Return to:

Send suggestions and report system problems to the System administrator.