Skip to content

Commit

Permalink
Now prints a nice warning instead of failing tests when js2py isn't i…
Browse files Browse the repository at this point in the history
…nstalled
  • Loading branch information
erezsh committed Oct 22, 2019
1 parent 35e1029 commit f3714a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
try:
from .test_nearley.test_nearley import TestNearley
except ImportError:
pass
logging.warn("Warning: Skipping tests for Nearley (js2py required)")

# from .test_selectors import TestSelectors
# from .test_grammars import TestPythonG, TestConfigG
Expand Down
5 changes: 4 additions & 1 deletion tests/test_nearley/test_nearley.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
BUILTIN_PATH = os.path.join(NEARLEY_PATH, 'builtin')

if not os.path.exists(NEARLEY_PATH):
print("Skipping Nearley tests!")
logging.warn("Nearley not installed. Skipping Nearley tests!")
raise ImportError("Skipping Nearley tests!")

import js2py # Ensures that js2py exists, to avoid failing tests


class TestNearley(unittest.TestCase):
def test_css(self):
fn = os.path.join(NEARLEY_PATH, 'examples/csscolor.ne')
Expand Down

0 comments on commit f3714a5

Please sign in to comment.