aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2012-01-18 10:27:19 +0100
committerMatěj Cepl <mcepl@redhat.com>2012-01-18 10:27:19 +0100
commit4a196e71d4aa325b93749b015a757109de006db5 (patch)
tree3a820048abbfcb6fe6a36c6635bea04e33385d64
parentddeec222e02608798e3f9bc6a806343da7777332 (diff)
downloadjson_diff-4a196e71d4aa325b93749b015a757109de006db5.tar.gz
Plenty of setup.py work.1.2.7
* Yet another (hopefully the last) fix of the development website. We are on fedorahosted.org now. * Move tests to test/ module * Clean up setup.py (when using defaults, install doesn’t install tests, which I like) * Add new setup.py command test to run the test suite.
-rw-r--r--.gitignore1
-rw-r--r--NEWS.txt45
-rw-r--r--README.txt2
-rwxr-xr-xjson_diff.py2
-rw-r--r--setup.py43
-rw-r--r--test/__init__.py1
-rw-r--r--test/test_json_diff.py (renamed from test_json_diff.py)11
-rw-r--r--test/test_strings.py (renamed from test_strings.py)0
8 files changed, 94 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore
index 4f0f98f..748961b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
*~
dist/
MANIFEST
+build/
diff --git a/NEWS.txt b/NEWS.txt
new file mode 100644
index 0000000..6742cc9
--- /dev/null
+++ b/NEWS.txt
@@ -0,0 +1,45 @@
+1.2.7 2012-01-18
+ * Yet another (hopefully the last) fix of the development website. We are on fedorahosted.org now.
+
+1.2.6 2012-01-18
+ * Move tests to test/ module
+ * Clean up setup.py (when using defaults, install doesn’t install tests,
+ which I like)
+ * Add new setup.py command test to run the test suite.
+
+1.2.5 2012-01-11
+ * Switch the project’s website and clean up UTF-8 metadata.
+
+1.2.1 2011-12-03
+ * Change of the home URL to my trac.
+
+1.2.0 2011-12-01
+ * One more python 2.4 compatibility fix.
+ Maintainer of optparse library couldn't have a better idea than to change
+ "usage:" to "Usage:" (between 2.4 and 2.6)! Grrrrrrr.
+
+1.2.0 2011-12-01
+ * Fix locale.setlocale to work on RHEL 5.
+
+1.2.0 2011-11-30
+ * Make tests working independently of the locale set on the system.
+
+1.2.0 2011-11-30
+ * Set exit status of json_diff command.
+ 0 means no difference
+ 1 there is a difference.
+ * Now actually works correctly with non-mandatory options.
+
+1.1.0 2011-11-29
+ * Make scripts pylint and PEP8 compliant.
+ * Add option -a to ignore appended keys (for comparing changing piglit tests).
+ * Fix formatted output to stdout (or file).
+ * Added test for -i functionality.
+
+0.9.2 2011-11-21
+ Python 2.4 compatible
+
+0.9.1 2011-11-21
+ Two small nits in __main__ part.
+
+(for detailed log of all changes see git log) \ No newline at end of file
diff --git a/README.txt b/README.txt
index b944db6..2ae2c86 100644
--- a/README.txt
+++ b/README.txt
@@ -2,7 +2,7 @@ Compares two JSON files (http://json.org) and generates a new JSON file
with the result. Allows exclusion of some keys from the comparison, or
in other way to include only some keys.
-The development repository is at https://gitorious.org/json_diff/mainline
+The project’s website is at https://fedorahosted.org/json_diff/
Patches and pull requests are welcome, but please keep the script compatible
with python 2.4.
diff --git a/json_diff.py b/json_diff.py
index 725808d..b77cf3c 100755
--- a/json_diff.py
+++ b/json_diff.py
@@ -32,7 +32,7 @@ import logging
from optparse import OptionParser
__author__ = "Matěj Cepl"
-__version__ = "1.2.5"
+__version__ = "1.2.7"
import locale
diff --git a/setup.py b/setup.py
index 56b2871..f1be6d3 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,38 @@
# coding: utf-8
-from distutils.core import setup
+from distutils.core import setup, Command
+import os.path
import json_diff
+
+class RunTests(Command):
+ """New setup.py command to run all tests for the package.
+ """
+ description = "run all tests for the package"
+
+ user_options = []
+
+ def initialize_options(self):
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ import unittest
+ import test.test_json_diff
+ unittest.TextTestRunner(verbosity=2).run(test.test_json_diff.suite)
+
+
+def read(fname):
+ with open(os.path.join(os.path.dirname(__file__), fname)) as f:
+ return "\n" + f.read().replace("\r\n", "\n")
+
+
+def get_long_description():
+ return read("README.txt") \
+ + "\nChangelog:\n" + "=" * 10 + "\n" \
+ + read("NEWS.txt")
+
setup(
name='json_diff',
version='%s' % json_diff.__version__,
@@ -9,14 +40,10 @@ setup(
author='Matěj Cepl',
author_email='mcepl@redhat.com',
url='https://fedorahosted.org/json_diff/',
- py_modules=['json_diff', 'test_json_diff', 'test_strings'],
- package_data={
- 'json_diff': 'test/*'
- },
- long_description="""Compares two JSON files (http://json.org) and
-generates a new JSON file with the result. Allows exclusion of some
-keys from the comparison, or in other way to include only some keys.""",
+ py_modules=['json_diff'],
+ long_description=get_long_description(),
keywords=['json', 'diff'],
+ cmdclass={'test': RunTests},
classifiers=[
"Programming Language :: Python",
"Development Status :: 4 - Beta",
diff --git a/test/__init__.py b/test/__init__.py
new file mode 100644
index 0000000..1b30feb
--- /dev/null
+++ b/test/__init__.py
@@ -0,0 +1 @@
+"This package contains automated code tests for json_diff."
diff --git a/test_json_diff.py b/test/test_json_diff.py
index 9847642..cb2e878 100644
--- a/test_json_diff.py
+++ b/test/test_json_diff.py
@@ -135,7 +135,7 @@ class TestHappyPath(OurTestCase):
"Nested objects diff.", OptionsClass(ign=True))
-class TestadPath(OurTestCase):
+class TestBadPath(OurTestCase):
def test_no_JSON(self):
self.assertRaises(json_diff.BadJSONError,
json_diff.Comparator, StringIO(NO_JSON_OLD),
@@ -215,5 +215,14 @@ class TestMainArgsMgmt(unittest.TestCase):
"\n\nexpected = %d\n\nobserved = %d" %
(1, res))
+add_tests_from_class = unittest.TestLoader().loadTestsFromTestCase
+
+suite = unittest.TestSuite()
+suite.addTest(add_tests_from_class(TestBasicJSON))
+suite.addTest(add_tests_from_class(TestHappyPath))
+suite.addTest(add_tests_from_class(TestBadPath))
+suite.addTest(add_tests_from_class(TestPiglitData))
+suite.addTest(add_tests_from_class(TestMainArgsMgmt))
+
if __name__ == "__main__":
unittest.main()
diff --git a/test_strings.py b/test/test_strings.py
index af86ab7..af86ab7 100644
--- a/test_strings.py
+++ b/test/test_strings.py