From a6e7a62d11d9e529ba7849a2dbdfae1b439d8f6b Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Tue, 13 Jun 2017 11:02:46 +0300 Subject: [PATCH 01/12] Added travis.yml. --- .travis.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..d6db68eb --- /dev/null +++ b/.travis.yml @@ -0,0 +1,20 @@ +sudo: false +dist: trusty +language: python +cache: pip +python: + - '2.7' + - '3.4' + - '3.5' + - '3.6' + - pypy-5.7.1 + +install: pip install .[pyxl,pinq,js_snippets] + +script: python run_tests.py +matrix: + allow_failures: + - python: 3.4 + - python: 3.5 + - python: 3.6 + fast_finish: true From 27ea2f58a64d8b90c41986938a179f0cd9b589b8 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Tue, 13 Jun 2017 12:25:52 +0300 Subject: [PATCH 02/12] Remove pyxl from build since it is not installable. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d6db68eb..95090638 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ python: - '3.6' - pypy-5.7.1 -install: pip install .[pyxl,pinq,js_snippets] +install: pip install .[pinq,js_snippets] script: python run_tests.py matrix: From 0682f59eb21a3b5a6e0d47afdad3399dfb50e711 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Tue, 13 Jun 2017 12:30:56 +0300 Subject: [PATCH 03/12] Install pyxl through git for now. --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 95090638..1e58439d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,9 @@ python: - '3.6' - pypy-5.7.1 -install: pip install .[pinq,js_snippets] +install: + - pip install .[pinq,js_snippets] + - pip install git+https://github.com/dropbox/pyxl script: python run_tests.py matrix: From e411c995dcd52315201101b738e719314118b925 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Tue, 13 Jun 2017 12:34:31 +0300 Subject: [PATCH 04/12] Exit with return code 1 when tests fail. --- run_tests.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/run_tests.py b/run_tests.py index 51ad8284..8b2e70b0 100644 --- a/run_tests.py +++ b/run_tests.py @@ -1,9 +1,11 @@ +import sys import unittest import macropy.activate import macropy.test -unittest.TextTestRunner().run(macropy.test.Tests) +result = unittest.TextTestRunner().run(macropy.test.Tests) +sys.exit(1 if result.errors or result.failures else 0) From 65dbf4488e4042f967a49e9adf97721f043e58df Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Tue, 13 Jun 2017 13:27:38 +0300 Subject: [PATCH 05/12] Use os.path.join instead of +. --- macropy/test/peg.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/macropy/test/peg.py b/macropy/test/peg.py index ec5f3823..641f1abb 100644 --- a/macropy/test/peg.py +++ b/macropy/test/peg.py @@ -1,3 +1,4 @@ +import os import unittest from macropy.peg import macros, peg, Success, cut, ParseError @@ -369,7 +370,7 @@ def decode(x): if i not in [18]: # skipping the "too much nesting" failure test with self.assertRaises(ParseError): - json_doc.parse(open(__file__ + "/../peg_json/fail%s.json" % i).read()) + json_doc.parse(open(os.path.join(__file__, "/../peg_json/fail%s.json" % i)).read()) for i in [1, 2, 3]: - test(json_exp, open(__file__ + "/../peg_json/pass%s.json" % i).read()) + test(json_exp, open(os.path.join(__file__, "/../peg_json/pass%s.json" % i)).read()) From ea80dbe127ed4147b196d816839d0b755047ee6f Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Tue, 13 Jun 2017 13:39:35 +0300 Subject: [PATCH 06/12] Fix path errors. --- macropy/core/test/exporters/__init__.py | 8 ++++---- macropy/core/test/exporters/pyc_cache.py | 2 +- macropy/test/peg.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/macropy/core/test/exporters/__init__.py b/macropy/core/test/exporters/__init__.py index fd3116db..4a81e454 100644 --- a/macropy/core/test/exporters/__init__.py +++ b/macropy/core/test/exporters/__init__.py @@ -30,7 +30,7 @@ def test_pyc_exporter(self): # unless you touch the file to bring its mtime up to that of the # stored .pyc, in which case the macro gets re-run too - f = open(__file__ + "/../pyc_cache.py", "a") + f = open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "pyc_cache.py"), "a") f.write(" ") f.close() @@ -40,7 +40,7 @@ def test_pyc_exporter(self): reload(pyc_cache) assert (pyc_cache_count, pyc_cache_macro_count) == (7, 4) - f = open(__file__ + "/../pyc_cache.py", "a") + f = open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "pyc_cache.py"), "a") f.write(" ") f.close() @@ -50,7 +50,7 @@ def test_pyc_exporter(self): def test_save_exporter(self): import macropy - macropy.exporter = SaveExporter(__file__ + "/../exported", __file__ + "/..") + macropy.exporter = SaveExporter(os.path.join(os.path.dirname(os.path.abspath(__file__)), "exported"), os.path.dirname(os.path.abspath(__file__))) # the original code should work import save @@ -62,4 +62,4 @@ def test_save_exporter(self): import macropy.core.test.exporters.exported.save as save_exported assert save_exported.run() == 14 import shutil - shutil.rmtree(__file__ + "/../exported") \ No newline at end of file + shutil.rmtree(os.path.join(os.path.dirname(os.path.abspath(__file__)), "exported")) diff --git a/macropy/core/test/exporters/pyc_cache.py b/macropy/core/test/exporters/pyc_cache.py index 1b43268f..b05efa9d 100644 --- a/macropy/core/test/exporters/pyc_cache.py +++ b/macropy/core/test/exporters/pyc_cache.py @@ -2,4 +2,4 @@ from macropy.core.test import exporters exporters.pyc_cache_count += 1 -f[1] \ No newline at end of file +f[1] \ No newline at end of file diff --git a/macropy/test/peg.py b/macropy/test/peg.py index 641f1abb..3473b161 100644 --- a/macropy/test/peg.py +++ b/macropy/test/peg.py @@ -370,7 +370,7 @@ def decode(x): if i not in [18]: # skipping the "too much nesting" failure test with self.assertRaises(ParseError): - json_doc.parse(open(os.path.join(__file__, "/../peg_json/fail%s.json" % i)).read()) + json_doc.parse(open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "peg_json/fail%s.json" % i)).read()) for i in [1, 2, 3]: - test(json_exp, open(os.path.join(__file__, "/../peg_json/pass%s.json" % i)).read()) + test(json_exp, open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "peg_json/pass%s.json" % i)).read()) From 6e2c6ba740664db6ff0778998696ee5bc45c3630 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Tue, 13 Jun 2017 13:42:26 +0300 Subject: [PATCH 07/12] Don't run pyxl tests if it cannot be imported. --- macropy/core/test/exporters/pyc_cache.py | 2 +- macropy/experimental/test/__init__.py | 17 +++++++++-------- macropy/experimental/test/pyxl_snippets.py | 3 --- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/macropy/core/test/exporters/pyc_cache.py b/macropy/core/test/exporters/pyc_cache.py index b05efa9d..d3df403b 100644 --- a/macropy/core/test/exporters/pyc_cache.py +++ b/macropy/core/test/exporters/pyc_cache.py @@ -2,4 +2,4 @@ from macropy.core.test import exporters exporters.pyc_cache_count += 1 -f[1] \ No newline at end of file +f[1] \ No newline at end of file diff --git a/macropy/experimental/test/__init__.py b/macropy/experimental/test/__init__.py index 2ee13aea..5b107871 100644 --- a/macropy/experimental/test/__init__.py +++ b/macropy/experimental/test/__init__.py @@ -2,13 +2,14 @@ #import js_snippets #import pattern #import pinq -import pyxl_snippets +cases = [] +try: + import pyxl +except ImportError: + pass +else: + import pyxl_snippets + cases.append(pyxl_snippets) #import tco_test -Tests = test_suite(cases = [ - #js_snippets, - #pattern, - #pinq, - pyxl_snippets, - #tco_test -]) \ No newline at end of file +Tests = test_suite(cases = cases) diff --git a/macropy/experimental/test/pyxl_snippets.py b/macropy/experimental/test/pyxl_snippets.py index 5864ddbe..73e0528f 100644 --- a/macropy/experimental/test/pyxl_snippets.py +++ b/macropy/experimental/test/pyxl_snippets.py @@ -94,6 +94,3 @@ def render(self): with require: normalize(pyxl_blob.to_string()) == normalize(target_blob) - - - From 4a3c11afce31c9a83e0154b0b3e314f4265487fb Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Tue, 13 Jun 2017 13:43:00 +0300 Subject: [PATCH 08/12] Remove pyxl as the tests for it fail. --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1e58439d..95090638 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,9 +9,7 @@ python: - '3.6' - pypy-5.7.1 -install: - - pip install .[pinq,js_snippets] - - pip install git+https://github.com/dropbox/pyxl +install: pip install .[pinq,js_snippets] script: python run_tests.py matrix: From 166246d2a1f3f1b86a5ff7050f730588f689fbae Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Tue, 13 Jun 2017 14:44:39 +0300 Subject: [PATCH 09/12] Remove Python 3 from matrix as it fails installing. Turn off unrolling for PyPy. --- .travis.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 95090638..538098b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,17 +4,12 @@ language: python cache: pip python: - '2.7' - - '3.4' - - '3.5' - - '3.6' - - pypy-5.7.1 install: pip install .[pinq,js_snippets] script: python run_tests.py matrix: - allow_failures: - - python: 3.4 - - python: 3.5 - - python: 3.6 + include: + python: pypy-5.7.1 + script: python --jit disable_unrolling=0 fast_finish: true From 4bd6bc9491a40d8c7c1d8db1ea74587c6c387d38 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Tue, 13 Jun 2017 14:47:05 +0300 Subject: [PATCH 10/12] Fix syntax. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 538098b8..01a588c8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,6 @@ install: pip install .[pinq,js_snippets] script: python run_tests.py matrix: include: - python: pypy-5.7.1 + - python: pypy-5.7.1 script: python --jit disable_unrolling=0 fast_finish: true From 26ba137fbfe575333920479e01837c9b70592fb5 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Tue, 13 Jun 2017 14:57:05 +0300 Subject: [PATCH 11/12] Forget the matrix. Customize the script instead. --- .travis.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 01a588c8..dd6caa5c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,12 +4,16 @@ language: python cache: pip python: - '2.7' + - pypy-5.7.1 install: pip install .[pinq,js_snippets] -script: python run_tests.py +script: + - | + if [[ "$TRAVIS_PYTHON_VERSION" == "pypy"* ]]; then + python --jit disable_unrolling=0 run_tests.py + else + python run_tests.py + fi matrix: - include: - - python: pypy-5.7.1 - script: python --jit disable_unrolling=0 fast_finish: true From a6fabf982dff306094d4366dcbdbb6adab601b24 Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Tue, 13 Jun 2017 14:59:58 +0300 Subject: [PATCH 12/12] Fix bash syntax. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dd6caa5c..a1c6a7a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ install: pip install .[pinq,js_snippets] script: - | - if [[ "$TRAVIS_PYTHON_VERSION" == "pypy"* ]]; then + if [[ "${TRAVIS_PYTHON_VERSION}" == "pypy"* ]]; then python --jit disable_unrolling=0 run_tests.py else python run_tests.py