Skip to content
19 changes: 19 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
sudo: false
dist: trusty
language: python
cache: pip
python:
- '2.7'
- pypy-5.7.1

install: pip install .[pinq,js_snippets]

script:
- |
if [[ "${TRAVIS_PYTHON_VERSION}" == "pypy"* ]]; then
python --jit disable_unrolling=0 run_tests.py
else
python run_tests.py
fi
matrix:
fast_finish: true
8 changes: 4 additions & 4 deletions macropy/core/test/exporters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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()

Expand All @@ -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
Expand All @@ -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")
shutil.rmtree(os.path.join(os.path.dirname(os.path.abspath(__file__)), "exported"))
2 changes: 1 addition & 1 deletion macropy/core/test/exporters/pyc_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
from macropy.core.test import exporters

exporters.pyc_cache_count += 1
f[1]
f[1]
17 changes: 9 additions & 8 deletions macropy/experimental/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
])
Tests = test_suite(cases = cases)
3 changes: 0 additions & 3 deletions macropy/experimental/test/pyxl_snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,3 @@ def render(self):

with require:
normalize(pyxl_blob.to_string()) == normalize(target_blob)



5 changes: 3 additions & 2 deletions macropy/test/peg.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import unittest
from macropy.peg import macros, peg, Success, cut, ParseError

Expand Down Expand Up @@ -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(os.path.dirname(os.path.abspath(__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(os.path.dirname(os.path.abspath(__file__)), "peg_json/pass%s.json" % i)).read())
4 changes: 3 additions & 1 deletion run_tests.py
Original file line number Diff line number Diff line change
@@ -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)



Expand Down