← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/lpjsmin/tox into lp:lpjsmin

 

Colin Watson has proposed merging lp:~cjwatson/lpjsmin/tox into lp:lpjsmin.

Commit message:
Add tox testing support and drop buildout.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/lpjsmin/tox/+merge/379695
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/lpjsmin/tox into lp:lpjsmin.
=== modified file '.bzrignore'
--- .bzrignore	2012-02-17 00:41:48 +0000
+++ .bzrignore	2020-02-23 15:20:04 +0000
@@ -1,10 +1,7 @@
+*.egg-info
 *.pyc
-.installed.cfg
+.tox
 bin
-develop-eggs
-*.egg-info
-tmp
 build
 dist
-eggs
-parts
+tmp

=== renamed file 'HACKING.txt' => 'HACKING.rst'
--- HACKING.txt	2012-06-11 13:59:27 +0000
+++ HACKING.rst	2020-02-23 15:20:04 +0000
@@ -1,17 +1,14 @@
 Development setup
 =================
 
-To create a buildout,
-
-  $ python bootstrap.py
-  $ make all
+To run this project's tests, use `tox <https://tox.readthedocs.io/en/latest/>`.
 
 Release HOWTO
 =============
 
 To make a release,
 
-  1) Update release date/version in NEWS.txt and setup.py
+  1) Update release date/version in NEWS.rst and setup.py
   2) Run 'python setup.py sdist'
   3) Test the generated source distribution in dist/
   4) Upload to PyPI: 'python setup.py sdist register upload'

=== modified file 'MANIFEST.in'
--- MANIFEST.in	2012-02-16 20:11:10 +0000
+++ MANIFEST.in	2020-02-23 15:20:04 +0000
@@ -1,2 +1,3 @@
 include README.rst
-include NEWS.txt
+include NEWS.rst
+recursive-include src *.js

=== modified file 'Makefile'
--- Makefile	2012-02-17 00:36:28 +0000
+++ Makefile	2020-02-23 15:20:04 +0000
@@ -1,17 +1,13 @@
 # Makefile to help automate tasks
 
-BUILDOUT = bin/buildout
-TEST = bin/test
-
-all: buildout
-
-buildout:
-	$(BUILDOUT)
+PYTHON = python
+
+all: test
 
 .PHONY: test
 test:
-	$(TEST)
+	tox
 
 .PHONY: dist
 dist:
-	$(BUILDOUT) setup . sdist
+	$(PYTHON) setup . sdist

=== renamed file 'NEWS.txt' => 'NEWS.rst'
--- NEWS.txt	2012-06-11 13:59:27 +0000
+++ NEWS.rst	2020-02-23 15:20:04 +0000
@@ -6,6 +6,12 @@
 News
 ====
 
+0.6
+---
+
+* Add tox testing support and drop buildout.
+
+
 0.5
 ---
 *Release date: 11-June-2012*

=== removed file 'bootstrap.py'
=== removed file 'buildout.cfg'
=== modified file 'setup.py'
--- setup.py	2012-06-11 13:59:27 +0000
+++ setup.py	2020-02-23 15:20:04 +0000
@@ -3,7 +3,7 @@
 
 here = os.path.abspath(os.path.dirname(__file__))
 README = open(os.path.join(here, 'README.rst')).read()
-NEWS = open(os.path.join(here, 'NEWS.txt')).read()
+NEWS = open(os.path.join(here, 'NEWS.rst')).read()
 
 
 version = '0.5'
@@ -37,6 +37,7 @@
     zip_safe=False,
     install_requires=install_requires,
     tests_require=tests_require,
+    extras_require={'test': tests_require},
     entry_points={
         'console_scripts':
             ['lpjsmin=lpjsmin:main']

=== renamed directory 'tests' => 'src/lpjsmin/tests'
=== modified file 'src/lpjsmin/tests/__init__.py'
--- tests/__init__.py	2012-06-11 13:59:27 +0000
+++ src/lpjsmin/tests/__init__.py	2020-02-23 15:20:04 +0000
@@ -18,14 +18,15 @@
 import lpjsmin
 
 
+TEST_TOP = os.path.dirname(__file__)
 MINIMIZED1 = """
 var test=function(one){console.log('something');};"""
 MINIMIZED2 = """
 var test2=function(one){console.log('something2');};"""
-SAMPLE1 = "jsfiles/sample1.js"
-RES1 = "jsfiles/sample1-min.js"
-SAMPLE2 = "jsfiles/sample2.js"
-RES2 = "jsfiles/sample2-min.js"
+SAMPLE1 = os.path.join(TEST_TOP, "jsfiles", "sample1.js")
+RES1 = os.path.join(TEST_TOP, "jsfiles", "sample1-min.js")
+SAMPLE2 = os.path.join(TEST_TOP, "jsfiles", "sample2.js")
+RES2 = os.path.join(TEST_TOP, "jsfiles", "sample2-min.js")
 
 
 class TestMinify(TestCase):
@@ -33,7 +34,7 @@
 
     def tearDown(self):
         """Make sure we remove generated files"""
-        for f in glob.glob('jsfiles/*-min.js'):
+        for f in glob.glob(os.path.join(TEST_TOP, 'jsfiles', '*-min.js')):
             os.remove(f)
 
     def test_sample1(self):
@@ -50,7 +51,7 @@
 
     def tearDown(self):
         """Make sure we remove generated files"""
-        for f in glob.glob('jsfiles/*-min.js'):
+        for f in glob.glob(os.path.join(TEST_TOP, 'jsfiles', '*-min.js')):
             os.remove(f)
 
     def test_single_file(self):
@@ -64,7 +65,7 @@
 
     def test_directory(self):
         """Now try to min the entire directory in one swoop via the cmdline"""
-        call(['lpjsmin', '-p', 'jsfiles'])
+        call(['lpjsmin', '-p', os.path.join(TEST_TOP, 'jsfiles')])
 
         ok_(os.path.isfile(RES1), "The -min.js file should exist in place")
         content = open(RES1).read()
@@ -102,11 +103,12 @@
     def test_skip_css_files(self):
         """We don't attempt to process no js files."""
         expected_filenames = [
-            'jsfiles/sample1.js',
-            'jsfiles/sample2.js'
+            os.path.join(TEST_TOP, 'jsfiles', 'sample1.js'),
+            os.path.join(TEST_TOP, 'jsfiles', 'sample2.js'),
         ]
 
-        eq_(expected_filenames, list(lpjsmin.dirwalk('jsfiles')))
+        eq_(expected_filenames,
+            list(lpjsmin.dirwalk(os.path.join(TEST_TOP, 'jsfiles'))))
 
 
 class TestStream(TestCase):

=== added file 'tox.ini'
--- tox.ini	1970-01-01 00:00:00 +0000
+++ tox.ini	2020-02-23 15:20:04 +0000
@@ -0,0 +1,9 @@
+[tox]
+envlist =
+    py27
+
+[testenv]
+commands =
+    nosetests {posargs}
+deps =
+    .[test]