summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Beazley <dave@dabeaz.com>2022-10-27 13:44:12 -0500
committerDavid Beazley <dave@dabeaz.com>2022-10-27 13:44:12 -0500
commitaf80858e888c5f36979da88fcb1080de7b848967 (patch)
tree2f2fb95414baee83e489eac1b936602599ea9eba
parent818ab0684e33f5f513fc839673ff56ea330b6380 (diff)
downloadply-af80858e888c5f36979da88fcb1080de7b848967.tar.gz
Reorganization. Added makefile
-rw-r--r--CHANGES7
-rw-r--r--MANIFEST.in4
-rw-r--r--Makefile26
-rw-r--r--README.md17
-rw-r--r--ply-2022_01_02.tar.gzbin49761 -> 0 bytes
-rw-r--r--ply-tests.tar.gzbin14317 -> 0 bytes
-rw-r--r--pyproject.toml3
-rw-r--r--setup.cfg18
-rw-r--r--src/ply/__init__.py (renamed from ply/__init__.py)2
-rw-r--r--src/ply/lex.py (renamed from ply/lex.py)0
-rw-r--r--src/ply/yacc.py (renamed from ply/yacc.py)0
-rw-r--r--test/testcpp.py153
-rw-r--r--tests/README (renamed from test/README)0
-rw-r--r--tests/calclex.py (renamed from test/calclex.py)3
-rwxr-xr-xtests/cleanup.sh (renamed from test/cleanup.sh)0
-rw-r--r--tests/lex_closure.py (renamed from test/lex_closure.py)3
-rw-r--r--tests/lex_doc1.py (renamed from test/lex_doc1.py)3
-rw-r--r--tests/lex_dup1.py (renamed from test/lex_dup1.py)3
-rw-r--r--tests/lex_dup2.py (renamed from test/lex_dup2.py)3
-rw-r--r--tests/lex_dup3.py (renamed from test/lex_dup3.py)3
-rw-r--r--tests/lex_empty.py (renamed from test/lex_empty.py)3
-rw-r--r--tests/lex_error1.py (renamed from test/lex_error1.py)3
-rw-r--r--tests/lex_error2.py (renamed from test/lex_error2.py)3
-rw-r--r--tests/lex_error3.py (renamed from test/lex_error3.py)3
-rw-r--r--tests/lex_error4.py (renamed from test/lex_error4.py)3
-rw-r--r--tests/lex_hedit.py (renamed from test/lex_hedit.py)2
-rw-r--r--tests/lex_ignore.py (renamed from test/lex_ignore.py)3
-rw-r--r--tests/lex_ignore2.py (renamed from test/lex_ignore2.py)3
-rw-r--r--tests/lex_literal1.py (renamed from test/lex_literal1.py)3
-rw-r--r--tests/lex_literal2.py (renamed from test/lex_literal2.py)3
-rw-r--r--tests/lex_literal3.py (renamed from test/lex_literal3.py)3
-rw-r--r--tests/lex_many_tokens.py (renamed from test/lex_many_tokens.py)2
-rw-r--r--tests/lex_module.py (renamed from test/lex_module.py)3
-rw-r--r--tests/lex_module_import.py (renamed from test/lex_module_import.py)0
-rw-r--r--tests/lex_object.py (renamed from test/lex_object.py)2
-rw-r--r--tests/lex_re1.py (renamed from test/lex_re1.py)3
-rw-r--r--tests/lex_re2.py (renamed from test/lex_re2.py)3
-rw-r--r--tests/lex_re3.py (renamed from test/lex_re3.py)3
-rw-r--r--tests/lex_rule1.py (renamed from test/lex_rule1.py)3
-rw-r--r--tests/lex_rule2.py (renamed from test/lex_rule2.py)3
-rw-r--r--tests/lex_rule3.py (renamed from test/lex_rule3.py)3
-rw-r--r--tests/lex_state1.py (renamed from test/lex_state1.py)3
-rw-r--r--tests/lex_state2.py (renamed from test/lex_state2.py)3
-rw-r--r--tests/lex_state3.py (renamed from test/lex_state3.py)3
-rw-r--r--tests/lex_state4.py (renamed from test/lex_state4.py)3
-rw-r--r--tests/lex_state5.py (renamed from test/lex_state5.py)3
-rw-r--r--tests/lex_state_noerror.py (renamed from test/lex_state_noerror.py)3
-rw-r--r--tests/lex_state_norule.py (renamed from test/lex_state_norule.py)3
-rw-r--r--tests/lex_state_try.py (renamed from test/lex_state_try.py)3
-rw-r--r--tests/lex_token1.py (renamed from test/lex_token1.py)3
-rw-r--r--tests/lex_token2.py (renamed from test/lex_token2.py)3
-rw-r--r--tests/lex_token3.py (renamed from test/lex_token3.py)3
-rw-r--r--tests/lex_token4.py (renamed from test/lex_token4.py)3
-rw-r--r--tests/lex_token_dup.py (renamed from test/lex_token_dup.py)3
-rw-r--r--tests/test_cpp_nonascii.c (renamed from test/test_cpp_nonascii.c)0
-rwxr-xr-xtests/testlex.py (renamed from test/testlex.py)19
-rw-r--r--tests/testyacc.py (renamed from test/testyacc.py)41
-rw-r--r--tests/yacc_badargs.py (renamed from test/yacc_badargs.py)2
-rw-r--r--tests/yacc_badid.py (renamed from test/yacc_badid.py)3
-rw-r--r--tests/yacc_badprec.py (renamed from test/yacc_badprec.py)3
-rw-r--r--tests/yacc_badprec2.py (renamed from test/yacc_badprec2.py)3
-rw-r--r--tests/yacc_badprec3.py (renamed from test/yacc_badprec3.py)3
-rw-r--r--tests/yacc_badrule.py (renamed from test/yacc_badrule.py)3
-rw-r--r--tests/yacc_badtok.py (renamed from test/yacc_badtok.py)3
-rw-r--r--tests/yacc_dup.py (renamed from test/yacc_dup.py)3
-rw-r--r--tests/yacc_error1.py (renamed from test/yacc_error1.py)3
-rw-r--r--tests/yacc_error2.py (renamed from test/yacc_error2.py)3
-rw-r--r--tests/yacc_error3.py (renamed from test/yacc_error3.py)3
-rw-r--r--tests/yacc_error4.py (renamed from test/yacc_error4.py)3
-rw-r--r--tests/yacc_error5.py (renamed from test/yacc_error5.py)3
-rw-r--r--tests/yacc_error6.py (renamed from test/yacc_error6.py)3
-rw-r--r--tests/yacc_error7.py (renamed from test/yacc_error7.py)3
-rw-r--r--tests/yacc_inf.py (renamed from test/yacc_inf.py)3
-rw-r--r--tests/yacc_literal.py (renamed from test/yacc_literal.py)3
-rw-r--r--tests/yacc_misplaced.py (renamed from test/yacc_misplaced.py)3
-rw-r--r--tests/yacc_missing1.py (renamed from test/yacc_missing1.py)3
-rw-r--r--tests/yacc_nested.py (renamed from test/yacc_nested.py)3
-rw-r--r--tests/yacc_nodoc.py (renamed from test/yacc_nodoc.py)3
-rw-r--r--tests/yacc_noerror.py (renamed from test/yacc_noerror.py)3
-rw-r--r--tests/yacc_nop.py (renamed from test/yacc_nop.py)3
-rw-r--r--tests/yacc_notfunc.py (renamed from test/yacc_notfunc.py)3
-rw-r--r--tests/yacc_notok.py (renamed from test/yacc_notok.py)4
-rw-r--r--tests/yacc_prec1.py (renamed from test/yacc_prec1.py)3
-rw-r--r--tests/yacc_rr.py (renamed from test/yacc_rr.py)3
-rw-r--r--tests/yacc_rr_unused.py (renamed from test/yacc_rr_unused.py)3
-rw-r--r--tests/yacc_simple.py (renamed from test/yacc_simple.py)3
-rw-r--r--tests/yacc_sr.py (renamed from test/yacc_sr.py)3
-rw-r--r--tests/yacc_term1.py (renamed from test/yacc_term1.py)3
-rw-r--r--tests/yacc_unicode_literals.py (renamed from test/yacc_unicode_literals.py)3
-rw-r--r--tests/yacc_unused.py (renamed from test/yacc_unused.py)3
-rw-r--r--tests/yacc_unused_rule.py (renamed from test/yacc_unused_rule.py)3
-rw-r--r--tests/yacc_uprec.py (renamed from test/yacc_uprec.py)3
-rw-r--r--tests/yacc_uprec2.py (renamed from test/yacc_uprec2.py)3
93 files changed, 95 insertions, 417 deletions
diff --git a/CHANGES b/CHANGES
index aefb2f9..0a88915 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,13 @@ maintained as a mature library. No new major features are planned, but
issues reported for bugs are still welcome. Any changes to the
software will be noted here.
+Version 2022.10.27
+------------------
+10/27/22 Reoganization/modernization of the build process. PLY continues
+ to make no package-installable releases. However, you can now
+ use the Makefile to build artifacts installable via pip.
+ Use `make test` to test and `make build` to build.
+
Version 2022_01_02
------------------
12/12/21 PLY is no longer being developed in public. Instead
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..cfcf771
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,4 @@
+include Makefile CONTRIBUTING.md
+recursive-include example *
+recursive-include tests *
+recursive-include docs *
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..683f97c
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,26 @@
+PYTHON=python3
+VENV=.venv
+
+# Setup and install all of the required tools for building, testing,
+# and deploying
+setup::
+ rm -rf $(VENV)
+ $(PYTHON) -m venv $(VENV)
+ ./$(VENV)/bin/python -m pip install pytest
+ ./$(VENV)/bin/python -m pip install pytest-cov
+ ./$(VENV)/bin/python -m pip install build
+ ./$(VENV)/bin/python -m pip install twine
+
+# Run unit tests
+test::
+ ./$(VENV)/bin/python -m pip install .
+ ./$(VENV)/bin/python tests/testlex.py
+ ./$(VENV)/bin/python tests/testyacc.py
+
+# Build an artifact suitable for installing with pip
+build::
+ ./$(VENV)/bin/python -m build
+
+# Install into the default Python
+install::
+ $(PYTHON) -m pip install .
diff --git a/README.md b/README.md
index 473e6d3..9e4e3f9 100644
--- a/README.md
+++ b/README.md
@@ -18,22 +18,17 @@ flexibility in terms of how you decide to use it. You can use PLY to
build Abstract Syntax Trees (ASTs), simple one-pass compilers,
protocol decoders, or even a more advanced parsing framework.
-## Important Notice - October 11, 2022
+## Important Notice - October 27, 2022
-I'm officially retiring the PLY project. There will be no further
-releases. Should you choose to still use it, the GitHub repo will
-remain alive--feel free to vendor the code and report bugs as you see
-fit. I'd like to thank everyone who contributed to the
-project over the last twenty-one years. -- Dave
+The PLY project will make no further package-installable releases.
+If you want the latest version, you'll need to download it here
+or clone the repo.
-## Download
-
-* [Current Release (ply-2022_01_02)](https://github.com/dabeaz/ply/raw/master/ply-2022_01_02.tar.gz)
-* [Historial Releases](https://github.com/dabeaz/archive/tree/main/ply)
+## Requirements
The current release of PLY requires the use of Python 3.6 or
greater. If you need to support an older version, download one of the
-historical releases.
+historical releases at https://github.com/dabeaz/archive/tree/main/ply.
## How to Install and Use
diff --git a/ply-2022_01_02.tar.gz b/ply-2022_01_02.tar.gz
deleted file mode 100644
index b464a14..0000000
--- a/ply-2022_01_02.tar.gz
+++ /dev/null
Binary files differ
diff --git a/ply-tests.tar.gz b/ply-tests.tar.gz
deleted file mode 100644
index 8ffa1aa..0000000
--- a/ply-tests.tar.gz
+++ /dev/null
Binary files differ
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..9787c3b
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,3 @@
+[build-system]
+requires = ["setuptools", "wheel"]
+build-backend = "setuptools.build_meta"
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..b4ba4ed
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,18 @@
+[metadata]
+name = ply
+version = 2022.10.27
+url = https://github.com/dabeaz/ply
+author = David Beazley
+author_email = "David Beazley" <dave@dabeaz.com>
+description = "PLY - Sly Lex Yacc"
+long_description = "PLY is an implementation of lex and yacc. No longer maintained on PyPI. Latest version on GitHub."
+license = MIT
+license_files = LICENSE
+classifiers =
+ License :: OSI Approved :: MIT License
+
+[options]
+package_dir =
+ =src
+
+packages = ply
diff --git a/ply/__init__.py b/src/ply/__init__.py
index 0ef83ef..45f28c5 100644
--- a/ply/__init__.py
+++ b/src/ply/__init__.py
@@ -2,4 +2,4 @@
# Author: David Beazley (dave@dabeaz.com)
# https://github.com/dabeaz/ply
-__version__ = '2022_01_02'
+__version__ = '2022.10.27'
diff --git a/ply/lex.py b/src/ply/lex.py
index de011fe..de011fe 100644
--- a/ply/lex.py
+++ b/src/ply/lex.py
diff --git a/ply/yacc.py b/src/ply/yacc.py
index 6528796..6528796 100644
--- a/ply/yacc.py
+++ b/src/ply/yacc.py
diff --git a/test/testcpp.py b/test/testcpp.py
deleted file mode 100644
index dbfb3e4..0000000
--- a/test/testcpp.py
+++ /dev/null
@@ -1,153 +0,0 @@
-from unittest import TestCase, main
-
-from multiprocessing import Process, Queue
-from six.moves.queue import Empty
-
-import sys
-import locale
-
-if ".." not in sys.path:
- sys.path.insert(0, "..")
-
-from ply.lex import lex
-from ply.cpp import *
-
-
-def preprocessing(in_, out_queue):
- out = None
-
- try:
- p = Preprocessor(lex())
- p.parse(in_)
- tokens = [t.value for t in p.parser]
- out = "".join(tokens)
- finally:
- out_queue.put(out)
-
-class CPPTests(TestCase):
- "Tests related to ANSI-C style lexical preprocessor."
-
- def __test_preprocessing(self, in_, expected, time_limit = 1.0):
- out_queue = Queue()
-
- preprocessor = Process(
- name = "PLY`s C preprocessor",
- target = preprocessing,
- args = (in_, out_queue)
- )
-
- preprocessor.start()
-
- try:
- out = out_queue.get(timeout = time_limit)
- except Empty:
- preprocessor.terminate()
- raise RuntimeError("Time limit exceeded!")
- else:
- self.assertMultiLineEqual(out, expected)
-
- def test_infinite_argument_expansion(self):
- # CPP does not drags set of currently expanded macros through macro
- # arguments expansion. If there is a match between an argument value
- # and name of an already expanded macro then CPP falls into infinite
- # recursion.
- self.__test_preprocessing("""\
-#define a(x) x
-#define b a(b)
-b
-""" , """\
-
-
-b"""
- )
-
-
- def test_concatenation(self):
- self.__test_preprocessing("""\
-#define a(x) x##_
-#define b(x) _##x
-#define c(x) _##x##_
-#define d(x,y) _##x##y##_
-
-a(i)
-b(j)
-c(k)
-d(q,s)"""
- , """\
-
-
-
-
-
-i_
-_j
-_k_
-_qs_"""
- )
-
- def test_deadloop_macro(self):
- # If there is a word which equals to name of a parametrized macro, then
- # attempt to expand such word as a macro manages the parser to fall
- # into an infinite loop.
-
- self.__test_preprocessing("""\
-#define a(x) x
-
-a;"""
- , """\
-
-
-a;"""
- )
-
- def test_index_error(self):
- # If there are no tokens after a word ("a") which equals to name of
- # a parameterized macro, then attempt to expand this word leads to
- # IndexError.
-
- self.__test_preprocessing("""\
-#define a(x) x
-
-a"""
- , """\
-
-
-a"""
- )
-
- def test_evalexpr(self):
- # #if 1 != 2 is not processed correctly; undefined values are converted
- # to 0L instead of 0 (issue #195)
- #
- self.__test_preprocessing("""\
-#if (1!=0) && (!x || (!(1==2)))
-a;
-#else
-b;
-#endif
-"""
- , """\
-
-a;
-
-"""
- )
-
- def test_include_nonascii(self):
- # Issue #196: #included files are read using the current locale's
- # getdefaultencoding. if a #included file contains non-ascii characters,
- # while default encoding is e.g. US_ASCII, this causes an error
- locale.setlocale(locale.LC_ALL, 'C')
- self.__test_preprocessing("""\
-#include "test_cpp_nonascii.c"
-x;
-
-"""
- , """\
-
-
-1;
-"""
- )
-
-main()
diff --git a/test/README b/tests/README
index 03b167c..03b167c 100644
--- a/test/README
+++ b/tests/README
diff --git a/test/calclex.py b/tests/calclex.py
index 030a986..4862753 100644
--- a/test/calclex.py
+++ b/tests/calclex.py
@@ -1,9 +1,6 @@
# -----------------------------------------------------------------------------
# calclex.py
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.lex as lex
tokens = (
diff --git a/test/cleanup.sh b/tests/cleanup.sh
index 9374f2c..9374f2c 100755
--- a/test/cleanup.sh
+++ b/tests/cleanup.sh
diff --git a/test/lex_closure.py b/tests/lex_closure.py
index 30ee679..0b34cff 100644
--- a/test/lex_closure.py
+++ b/tests/lex_closure.py
@@ -1,9 +1,6 @@
# -----------------------------------------------------------------------------
# lex_closure.py
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.lex as lex
tokens = (
diff --git a/test/lex_doc1.py b/tests/lex_doc1.py
index 8a2bfcc..4b62609 100644
--- a/test/lex_doc1.py
+++ b/tests/lex_doc1.py
@@ -2,9 +2,6 @@
#
# Missing documentation string
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_dup1.py b/tests/lex_dup1.py
index fd04cdb..b9dc3c5 100644
--- a/test/lex_dup1.py
+++ b/tests/lex_dup1.py
@@ -2,9 +2,6 @@
#
# Duplicated rule specifiers
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_dup2.py b/tests/lex_dup2.py
index 870e5e7..47bf5b5 100644
--- a/test/lex_dup2.py
+++ b/tests/lex_dup2.py
@@ -2,9 +2,6 @@
#
# Duplicated rule specifiers
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_dup3.py b/tests/lex_dup3.py
index 94b5592..5398f48 100644
--- a/test/lex_dup3.py
+++ b/tests/lex_dup3.py
@@ -2,9 +2,6 @@
#
# Duplicated rule specifiers
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_empty.py b/tests/lex_empty.py
index e0368bf..d0baf31 100644
--- a/test/lex_empty.py
+++ b/tests/lex_empty.py
@@ -2,9 +2,6 @@
#
# No rules defined
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_error1.py b/tests/lex_error1.py
index 4508a80..fec0282 100644
--- a/test/lex_error1.py
+++ b/tests/lex_error1.py
@@ -2,9 +2,6 @@
#
# Missing t_error() rule
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_error2.py b/tests/lex_error2.py
index 8040d39..8914ab6 100644
--- a/test/lex_error2.py
+++ b/tests/lex_error2.py
@@ -2,9 +2,6 @@
#
# t_error defined, but not function
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_error3.py b/tests/lex_error3.py
index 1feefb6..71ca903 100644
--- a/test/lex_error3.py
+++ b/tests/lex_error3.py
@@ -2,9 +2,6 @@
#
# t_error defined as function, but with wrong # args
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_error4.py b/tests/lex_error4.py
index f4f48db..5387808 100644
--- a/test/lex_error4.py
+++ b/tests/lex_error4.py
@@ -2,9 +2,6 @@
#
# t_error defined as function, but too many args
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_hedit.py b/tests/lex_hedit.py
index 34f15a1..9f724d0 100644
--- a/test/lex_hedit.py
+++ b/tests/lex_hedit.py
@@ -13,8 +13,6 @@
# This example shows how to modify the state of the lexer to parse
# such tokens
# -----------------------------------------------------------------------------
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.lex as lex
diff --git a/test/lex_ignore.py b/tests/lex_ignore.py
index 6c43b4c..b31fb39 100644
--- a/test/lex_ignore.py
+++ b/tests/lex_ignore.py
@@ -2,9 +2,6 @@
#
# Improperly specific ignore declaration
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_ignore2.py b/tests/lex_ignore2.py
index f60987a..de0958a 100644
--- a/test/lex_ignore2.py
+++ b/tests/lex_ignore2.py
@@ -2,9 +2,6 @@
#
# ignore declaration as a raw string
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_literal1.py b/tests/lex_literal1.py
index db389c3..510b379 100644
--- a/test/lex_literal1.py
+++ b/tests/lex_literal1.py
@@ -2,9 +2,6 @@
#
# Bad literal specification
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_literal2.py b/tests/lex_literal2.py
index b50b92c..a7a2c56 100644
--- a/test/lex_literal2.py
+++ b/tests/lex_literal2.py
@@ -2,9 +2,6 @@
#
# Bad literal specification
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_literal3.py b/tests/lex_literal3.py
index 91ab980..9d697c9 100644
--- a/test/lex_literal3.py
+++ b/tests/lex_literal3.py
@@ -3,9 +3,6 @@
# An empty literal specification given as a list
# Issue 8 : Literals empty list causes IndexError
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_many_tokens.py b/tests/lex_many_tokens.py
index 81ae57a..02e3a11 100644
--- a/test/lex_many_tokens.py
+++ b/tests/lex_many_tokens.py
@@ -4,8 +4,6 @@
# 100-group limit of the re module)
import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = ["TOK%d" % i for i in range(1000)]
diff --git a/test/lex_module.py b/tests/lex_module.py
index 8bdd3ed..0fa8544 100644
--- a/test/lex_module.py
+++ b/tests/lex_module.py
@@ -1,9 +1,6 @@
# lex_module.py
#
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
import lex_module_import
lex.lex(module=lex_module_import)
diff --git a/test/lex_module_import.py b/tests/lex_module_import.py
index df42082..df42082 100644
--- a/test/lex_module_import.py
+++ b/tests/lex_module_import.py
diff --git a/test/lex_object.py b/tests/lex_object.py
index 7e9f389..2fa7537 100644
--- a/test/lex_object.py
+++ b/tests/lex_object.py
@@ -1,9 +1,7 @@
# -----------------------------------------------------------------------------
# lex_object.py
# -----------------------------------------------------------------------------
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.lex as lex
class CalcLexer:
diff --git a/test/lex_re1.py b/tests/lex_re1.py
index 5be7aef..d6b7c38 100644
--- a/test/lex_re1.py
+++ b/tests/lex_re1.py
@@ -2,9 +2,6 @@
#
# Bad regular expression in a string
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_re2.py b/tests/lex_re2.py
index 8dfb8e3..f5ce695 100644
--- a/test/lex_re2.py
+++ b/tests/lex_re2.py
@@ -2,9 +2,6 @@
#
# Regular expression rule matches empty string
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_re3.py b/tests/lex_re3.py
index e179925..8f594f3 100644
--- a/test/lex_re3.py
+++ b/tests/lex_re3.py
@@ -2,9 +2,6 @@
#
# Regular expression rule matches empty string
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_rule1.py b/tests/lex_rule1.py
index 0406c6f..ae279e9 100644
--- a/test/lex_rule1.py
+++ b/tests/lex_rule1.py
@@ -2,9 +2,6 @@
#
# Rule function with incorrect number of arguments
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_rule2.py b/tests/lex_rule2.py
index 1c29d87..adefee2 100644
--- a/test/lex_rule2.py
+++ b/tests/lex_rule2.py
@@ -2,9 +2,6 @@
#
# Rule function with incorrect number of arguments
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_rule3.py b/tests/lex_rule3.py
index 9ea94da..bd61040 100644
--- a/test/lex_rule3.py
+++ b/tests/lex_rule3.py
@@ -2,9 +2,6 @@
#
# Rule function with incorrect number of arguments
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_state1.py b/tests/lex_state1.py
index 7528c91..6fa5e9f 100644
--- a/test/lex_state1.py
+++ b/tests/lex_state1.py
@@ -2,9 +2,6 @@
#
# Bad state declaration
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_state2.py b/tests/lex_state2.py
index 3aef69e..9300ed7 100644
--- a/test/lex_state2.py
+++ b/tests/lex_state2.py
@@ -2,9 +2,6 @@
#
# Bad state declaration
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_state3.py b/tests/lex_state3.py
index 616e484..2e5b7cf 100644
--- a/test/lex_state3.py
+++ b/tests/lex_state3.py
@@ -2,9 +2,6 @@
#
# Bad state declaration
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_state4.py b/tests/lex_state4.py
index 1825016..fb147c8 100644
--- a/test/lex_state4.py
+++ b/tests/lex_state4.py
@@ -2,9 +2,6 @@
#
# Bad state declaration
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_state5.py b/tests/lex_state5.py
index 4ce828e..fb2f3a7 100644
--- a/test/lex_state5.py
+++ b/tests/lex_state5.py
@@ -2,9 +2,6 @@
#
# Bad state declaration
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_state_noerror.py b/tests/lex_state_noerror.py
index 90bbea8..54b892e 100644
--- a/test/lex_state_noerror.py
+++ b/tests/lex_state_noerror.py
@@ -2,9 +2,6 @@
#
# Declaration of a state for which no rules are defined
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_state_norule.py b/tests/lex_state_norule.py
index 64ec6d3..4b979b2 100644
--- a/test/lex_state_norule.py
+++ b/tests/lex_state_norule.py
@@ -2,9 +2,6 @@
#
# Declaration of a state for which no rules are defined
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_state_try.py b/tests/lex_state_try.py
index fd5ba22..c5f3448 100644
--- a/test/lex_state_try.py
+++ b/tests/lex_state_try.py
@@ -2,9 +2,6 @@
#
# Declaration of a state for which no rules are defined
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_token1.py b/tests/lex_token1.py
index 6fca300..1001a99 100644
--- a/test/lex_token1.py
+++ b/tests/lex_token1.py
@@ -2,9 +2,6 @@
#
# Tests for absence of tokens variable
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
t_PLUS = r'\+'
diff --git a/test/lex_token2.py b/tests/lex_token2.py
index 6e65ab0..00e758b 100644
--- a/test/lex_token2.py
+++ b/tests/lex_token2.py
@@ -2,9 +2,6 @@
#
# Tests for tokens of wrong type
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = "PLUS MINUS NUMBER"
diff --git a/test/lex_token3.py b/tests/lex_token3.py
index 636452e..3b71b3a 100644
--- a/test/lex_token3.py
+++ b/tests/lex_token3.py
@@ -2,9 +2,6 @@
#
# tokens is right type, but is missing a token for one rule
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_token4.py b/tests/lex_token4.py
index 52947e9..89bc2e2 100644
--- a/test/lex_token4.py
+++ b/tests/lex_token4.py
@@ -2,9 +2,6 @@
#
# Bad token name
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/lex_token_dup.py b/tests/lex_token_dup.py
index 384f4e9..631535f 100644
--- a/test/lex_token_dup.py
+++ b/tests/lex_token_dup.py
@@ -2,9 +2,6 @@
#
# Duplicate token name in tokens
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
-
import ply.lex as lex
tokens = [
diff --git a/test/test_cpp_nonascii.c b/tests/test_cpp_nonascii.c
index 3e97d81..3e97d81 100644
--- a/test/test_cpp_nonascii.c
+++ b/tests/test_cpp_nonascii.c
diff --git a/test/testlex.py b/tests/testlex.py
index a41fda8..7f2adad 100755
--- a/test/testlex.py
+++ b/tests/testlex.py
@@ -11,7 +11,6 @@ import os
import warnings
import platform
-sys.path.insert(0,"..")
sys.tracebacklimit = 0
import ply.lex
@@ -98,24 +97,24 @@ class LexErrorWarningTests(unittest.TestCase):
self.assertRaises(SyntaxError,run_import,"lex_doc1")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "lex_doc1.py:18: No regular expression defined for rule 't_NUMBER'\n"))
+ "lex_doc1.py:15: No regular expression defined for rule 't_NUMBER'\n"))
def test_lex_dup1(self):
self.assertRaises(SyntaxError,run_import,"lex_dup1")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "lex_dup1.py:20: Rule t_NUMBER redefined. Previously defined on line 18\n" ))
+ "lex_dup1.py:17: Rule t_NUMBER redefined. Previously defined on line 15\n" ))
def test_lex_dup2(self):
self.assertRaises(SyntaxError,run_import,"lex_dup2")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "lex_dup2.py:22: Rule t_NUMBER redefined. Previously defined on line 18\n" ))
+ "lex_dup2.py:19: Rule t_NUMBER redefined. Previously defined on line 15\n" ))
def test_lex_dup3(self):
self.assertRaises(SyntaxError,run_import,"lex_dup3")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "lex_dup3.py:20: Rule t_NUMBER redefined. Previously defined on line 18\n" ))
+ "lex_dup3.py:17: Rule t_NUMBER redefined. Previously defined on line 15\n" ))
def test_lex_empty(self):
self.assertRaises(SyntaxError,run_import,"lex_empty")
@@ -141,19 +140,19 @@ class LexErrorWarningTests(unittest.TestCase):
self.assertRaises(SyntaxError,run_import,"lex_error3")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "lex_error3.py:20: Rule 't_error' requires an argument\n"))
+ "lex_error3.py:17: Rule 't_error' requires an argument\n"))
def test_lex_error4(self):
self.assertRaises(SyntaxError,run_import,"lex_error4")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "lex_error4.py:20: Rule 't_error' has too many arguments\n"))
+ "lex_error4.py:17: Rule 't_error' has too many arguments\n"))
def test_lex_ignore(self):
self.assertRaises(SyntaxError,run_import,"lex_ignore")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "lex_ignore.py:20: Rule 't_ignore' must be defined as a string\n"))
+ "lex_ignore.py:17: Rule 't_ignore' must be defined as a string\n"))
def test_lex_ignore2(self):
run_import("lex_ignore2")
@@ -206,13 +205,13 @@ class LexErrorWarningTests(unittest.TestCase):
self.assertRaises(SyntaxError,run_import,"lex_rule2")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "lex_rule2.py:18: Rule 't_NUMBER' requires an argument\n"))
+ "lex_rule2.py:15: Rule 't_NUMBER' requires an argument\n"))
def test_lex_rule3(self):
self.assertRaises(SyntaxError,run_import,"lex_rule3")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "lex_rule3.py:18: Rule 't_NUMBER' has too many arguments\n"))
+ "lex_rule3.py:15: Rule 't_NUMBER' has too many arguments\n"))
def test_lex_state1(self):
diff --git a/test/testyacc.py b/tests/testyacc.py
index c52d0ac..b488bf7 100644
--- a/test/testyacc.py
+++ b/tests/testyacc.py
@@ -12,7 +12,6 @@ import warnings
import re
import platform
-sys.path.insert(0,"..")
sys.tracebacklimit = 0
import ply.yacc
@@ -105,8 +104,8 @@ class YaccErrorWarningTests(unittest.TestCase):
self.assertRaises(ply.yacc.YaccError,run_import,"yacc_badid")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "yacc_badid.py:32: Illegal name 'bad&rule' in rule 'statement'\n"
- "yacc_badid.py:36: Illegal rule name 'bad&rule'\n"
+ "yacc_badid.py:29: Illegal name 'bad&rule' in rule 'statement'\n"
+ "yacc_badid.py:33: Illegal rule name 'bad&rule'\n"
))
def test_yacc_badprec(self):
@@ -137,10 +136,10 @@ class YaccErrorWarningTests(unittest.TestCase):
self.assertRaises(ply.yacc.YaccError,run_import,"yacc_badrule")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "yacc_badrule.py:24: Syntax error. Expected ':'\n"
- "yacc_badrule.py:28: Syntax error in rule 'statement'\n"
- "yacc_badrule.py:33: Syntax error. Expected ':'\n"
- "yacc_badrule.py:42: Syntax error. Expected ':'\n"
+ "yacc_badrule.py:21: Syntax error. Expected ':'\n"
+ "yacc_badrule.py:25: Syntax error in rule 'statement'\n"
+ "yacc_badrule.py:30: Syntax error. Expected ':'\n"
+ "yacc_badrule.py:39: Syntax error. Expected ':'\n"
))
def test_yacc_badtok(self):
@@ -155,7 +154,7 @@ class YaccErrorWarningTests(unittest.TestCase):
run_import("yacc_dup")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "yacc_dup.py:27: Function p_statement redefined. Previously defined on line 23\n"
+ "yacc_dup.py:24: Function p_statement redefined. Previously defined on line 20\n"
"Token 'EQUALS' defined, but not used\n"
"There is 1 unused token\n"
"Generating LALR tables\n"
@@ -167,7 +166,7 @@ class YaccErrorWarningTests(unittest.TestCase):
except ply.yacc.YaccError:
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "yacc_error1.py:61: p_error() requires 1 argument\n"))
+ "yacc_error1.py:58: p_error() requires 1 argument\n"))
def test_yacc_error2(self):
try:
@@ -175,7 +174,7 @@ class YaccErrorWarningTests(unittest.TestCase):
except ply.yacc.YaccError:
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "yacc_error2.py:61: p_error() requires 1 argument\n"))
+ "yacc_error2.py:58: p_error() requires 1 argument\n"))
def test_yacc_error3(self):
try:
@@ -190,7 +189,7 @@ class YaccErrorWarningTests(unittest.TestCase):
self.assertRaises(ply.yacc.YaccError,run_import,"yacc_error4")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "yacc_error4.py:62: Illegal rule name 'error'. Already defined as a token\n"
+ "yacc_error4.py:59: Illegal rule name 'error'. Already defined as a token\n"
))
@@ -237,20 +236,20 @@ class YaccErrorWarningTests(unittest.TestCase):
self.assertRaises(ply.yacc.YaccError,run_import,"yacc_literal")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "yacc_literal.py:36: Literal token '**' in rule 'expression' may only be a single character\n"
+ "yacc_literal.py:33: Literal token '**' in rule 'expression' may only be a single character\n"
))
def test_yacc_misplaced(self):
self.assertRaises(ply.yacc.YaccError,run_import,"yacc_misplaced")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "yacc_misplaced.py:32: Misplaced '|'\n"
+ "yacc_misplaced.py:29: Misplaced '|'\n"
))
def test_yacc_missing1(self):
self.assertRaises(ply.yacc.YaccError,run_import,"yacc_missing1")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "yacc_missing1.py:24: Symbol 'location' used, but not defined as a token or a rule\n"
+ "yacc_missing1.py:21: Symbol 'location' used, but not defined as a token or a rule\n"
))
def test_yacc_nested(self):
@@ -266,7 +265,7 @@ class YaccErrorWarningTests(unittest.TestCase):
run_import("yacc_nodoc")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "yacc_nodoc.py:27: No documentation string specified in function 'p_statement_expr' (ignored)\n"
+ "yacc_nodoc.py:24: No documentation string specified in function 'p_statement_expr' (ignored)\n"
"Generating LALR tables\n"
))
@@ -282,7 +281,7 @@ class YaccErrorWarningTests(unittest.TestCase):
run_import("yacc_nop")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "yacc_nop.py:27: Possible grammar rule 'statement_expr' defined without p_ prefix\n"
+ "yacc_nop.py:24: Possible grammar rule 'statement_expr' defined without p_ prefix\n"
"Generating LALR tables\n"
))
@@ -349,7 +348,7 @@ class YaccErrorWarningTests(unittest.TestCase):
self.assertRaises(ply.yacc.YaccError,run_import,"yacc_term1")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "yacc_term1.py:24: Illegal rule name 'NUMBER'. Already defined as a token\n"
+ "yacc_term1.py:21: Illegal rule name 'NUMBER'. Already defined as a token\n"
))
def test_yacc_unicode_literals(self):
@@ -363,7 +362,7 @@ class YaccErrorWarningTests(unittest.TestCase):
self.assertRaises(ply.yacc.YaccError,run_import,"yacc_unused")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "yacc_unused.py:62: Symbol 'COMMA' used, but not defined as a token or a rule\n"
+ "yacc_unused.py:59: Symbol 'COMMA' used, but not defined as a token or a rule\n"
"Symbol 'COMMA' is unreachable\n"
"Symbol 'exprlist' is unreachable\n"
))
@@ -371,7 +370,7 @@ class YaccErrorWarningTests(unittest.TestCase):
run_import("yacc_unused_rule")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "yacc_unused_rule.py:62: Rule 'integer' defined, but not used\n"
+ "yacc_unused_rule.py:59: Rule 'integer' defined, but not used\n"
"There is 1 unused rule\n"
"Symbol 'integer' is unreachable\n"
"Generating LALR tables\n"
@@ -381,14 +380,14 @@ class YaccErrorWarningTests(unittest.TestCase):
self.assertRaises(ply.yacc.YaccError,run_import,"yacc_uprec")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "yacc_uprec.py:37: Nothing known about the precedence of 'UMINUS'\n"
+ "yacc_uprec.py:34: Nothing known about the precedence of 'UMINUS'\n"
))
def test_yacc_uprec2(self):
self.assertRaises(ply.yacc.YaccError,run_import,"yacc_uprec2")
result = sys.stderr.getvalue()
self.assertTrue(check_expected(result,
- "yacc_uprec2.py:37: Syntax error. Nothing follows %prec\n"
+ "yacc_uprec2.py:34: Syntax error. Nothing follows %prec\n"
))
def test_yacc_prec1(self):
diff --git a/test/yacc_badargs.py b/tests/yacc_badargs.py
index 9a1d03f..cd4b1e7 100644
--- a/test/yacc_badargs.py
+++ b/tests/yacc_badargs.py
@@ -5,7 +5,7 @@
# -----------------------------------------------------------------------------
import sys
sys.tracebacklimit = 0
-sys.path.insert(0,"..")
+
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_badid.py b/tests/yacc_badid.py
index e4b9f5e..f624aca 100644
--- a/test/yacc_badid.py
+++ b/tests/yacc_badid.py
@@ -3,9 +3,6 @@
#
# Attempt to define a rule with a bad-identifier name
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_badprec.py b/tests/yacc_badprec.py
index 3013bb6..95e9db2 100644
--- a/test/yacc_badprec.py
+++ b/tests/yacc_badprec.py
@@ -3,9 +3,6 @@
#
# Bad precedence specifier
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_badprec2.py b/tests/yacc_badprec2.py
index 83093b4..c33303d 100644
--- a/test/yacc_badprec2.py
+++ b/tests/yacc_badprec2.py
@@ -3,9 +3,6 @@
#
# Bad precedence
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_badprec3.py b/tests/yacc_badprec3.py
index d925ecd..e1ce3a6 100644
--- a/test/yacc_badprec3.py
+++ b/tests/yacc_badprec3.py
@@ -3,9 +3,6 @@
#
# Bad precedence
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_badrule.py b/tests/yacc_badrule.py
index 92af646..898a8c7 100644
--- a/test/yacc_badrule.py
+++ b/tests/yacc_badrule.py
@@ -3,9 +3,6 @@
#
# Syntax problems in the rule strings
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_badtok.py b/tests/yacc_badtok.py
index fc4afe1..567aadf 100644
--- a/test/yacc_badtok.py
+++ b/tests/yacc_badtok.py
@@ -3,9 +3,6 @@
#
# A grammar, but tokens is a bad datatype
# -----------------------------------------------------------------------------
-
-import sys
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
tokens = "Hello"
diff --git a/test/yacc_dup.py b/tests/yacc_dup.py
index 309ba32..94238a4 100644
--- a/test/yacc_dup.py
+++ b/tests/yacc_dup.py
@@ -3,9 +3,6 @@
#
# Duplicated rule name
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_error1.py b/tests/yacc_error1.py
index 10ac6a9..39b9124 100644
--- a/test/yacc_error1.py
+++ b/tests/yacc_error1.py
@@ -3,9 +3,6 @@
#
# Bad p_error() function
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_error2.py b/tests/yacc_error2.py
index 7591418..2463ee9 100644
--- a/test/yacc_error2.py
+++ b/tests/yacc_error2.py
@@ -3,9 +3,6 @@
#
# Bad p_error() function
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_error3.py b/tests/yacc_error3.py
index 4604a48..f181253 100644
--- a/test/yacc_error3.py
+++ b/tests/yacc_error3.py
@@ -3,9 +3,6 @@
#
# Bad p_error() function
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_error4.py b/tests/yacc_error4.py
index 9c550cd..f6bef7e 100644
--- a/test/yacc_error4.py
+++ b/tests/yacc_error4.py
@@ -3,9 +3,6 @@
#
# Attempt to define a rule named 'error'
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_error5.py b/tests/yacc_error5.py
index 9eb0f85..5d4b683 100644
--- a/test/yacc_error5.py
+++ b/tests/yacc_error5.py
@@ -3,9 +3,6 @@
#
# Lineno and position tracking with error tokens
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_error6.py b/tests/yacc_error6.py
index 8d0ec85..fde3c4d 100644
--- a/test/yacc_error6.py
+++ b/tests/yacc_error6.py
@@ -3,9 +3,6 @@
#
# Panic mode recovery test
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_error7.py b/tests/yacc_error7.py
index abdc834..17cc4f1 100644
--- a/test/yacc_error7.py
+++ b/tests/yacc_error7.py
@@ -3,9 +3,6 @@
#
# Panic mode recovery test using deprecated functionality
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_inf.py b/tests/yacc_inf.py
index efd3612..f8b4c30 100644
--- a/test/yacc_inf.py
+++ b/tests/yacc_inf.py
@@ -3,9 +3,6 @@
#
# Infinite recursion
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_literal.py b/tests/yacc_literal.py
index 0d62803..687d916 100644
--- a/test/yacc_literal.py
+++ b/tests/yacc_literal.py
@@ -3,9 +3,6 @@
#
# Grammar with bad literal characters
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_misplaced.py b/tests/yacc_misplaced.py
index 9159b01..7cc75be 100644
--- a/test/yacc_misplaced.py
+++ b/tests/yacc_misplaced.py
@@ -3,9 +3,6 @@
#
# A misplaced | in grammar rules
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_missing1.py b/tests/yacc_missing1.py
index d1b5105..81955be 100644
--- a/test/yacc_missing1.py
+++ b/tests/yacc_missing1.py
@@ -3,9 +3,6 @@
#
# Grammar with a missing rule
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_nested.py b/tests/yacc_nested.py
index a3543a9..93ff400 100644
--- a/test/yacc_nested.py
+++ b/tests/yacc_nested.py
@@ -1,6 +1,3 @@
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
from ply import lex, yacc
diff --git a/test/yacc_nodoc.py b/tests/yacc_nodoc.py
index 0f61920..a2f34dd 100644
--- a/test/yacc_nodoc.py
+++ b/tests/yacc_nodoc.py
@@ -3,9 +3,6 @@
#
# Rule with a missing doc-string
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_noerror.py b/tests/yacc_noerror.py
index b38c758..2262745 100644
--- a/test/yacc_noerror.py
+++ b/tests/yacc_noerror.py
@@ -3,9 +3,6 @@
#
# No p_error() rule defined.
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_nop.py b/tests/yacc_nop.py
index 789a9cf..3ff17ac 100644
--- a/test/yacc_nop.py
+++ b/tests/yacc_nop.py
@@ -3,9 +3,6 @@
#
# Possible grammar rule defined without p_ prefix
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_notfunc.py b/tests/yacc_notfunc.py
index 5093a74..c8bd123 100644
--- a/test/yacc_notfunc.py
+++ b/tests/yacc_notfunc.py
@@ -3,9 +3,6 @@
#
# p_rule not defined as a function
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_notok.py b/tests/yacc_notok.py
index cff55a8..6e271a0 100644
--- a/test/yacc_notok.py
+++ b/tests/yacc_notok.py
@@ -3,10 +3,6 @@
#
# A grammar, but we forgot to import the tokens list
# -----------------------------------------------------------------------------
-
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
# Parsing rules
diff --git a/test/yacc_prec1.py b/tests/yacc_prec1.py
index 99fcd90..d4fad6e 100644
--- a/test/yacc_prec1.py
+++ b/tests/yacc_prec1.py
@@ -3,9 +3,6 @@
#
# Tests case where precedence specifier doesn't match up to terminals
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_rr.py b/tests/yacc_rr.py
index e7336c2..de78a58 100644
--- a/test/yacc_rr.py
+++ b/tests/yacc_rr.py
@@ -3,9 +3,6 @@
#
# A grammar with a reduce/reduce conflict
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_rr_unused.py b/tests/yacc_rr_unused.py
index 1ca5f7e..70a8c78 100644
--- a/test/yacc_rr_unused.py
+++ b/tests/yacc_rr_unused.py
@@ -4,9 +4,6 @@
# A grammar with reduce/reduce conflicts and a rule that never
# gets reduced.
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
tokens = ('A', 'B', 'C')
diff --git a/test/yacc_simple.py b/tests/yacc_simple.py
index bd989f4..5261838 100644
--- a/test/yacc_simple.py
+++ b/tests/yacc_simple.py
@@ -3,9 +3,6 @@
#
# A simple, properly specifier grammar
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_sr.py b/tests/yacc_sr.py
index 69a1e9c..0f15a50 100644
--- a/test/yacc_sr.py
+++ b/tests/yacc_sr.py
@@ -3,9 +3,6 @@
#
# A grammar with shift-reduce conflicts
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_term1.py b/tests/yacc_term1.py
index eaa36e9..1c1d8c2 100644
--- a/test/yacc_term1.py
+++ b/tests/yacc_term1.py
@@ -3,9 +3,6 @@
#
# Terminal used on the left-hand-side
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_unicode_literals.py b/tests/yacc_unicode_literals.py
index 5ae4f5b..04f6cfd 100644
--- a/test/yacc_unicode_literals.py
+++ b/tests/yacc_unicode_literals.py
@@ -5,9 +5,6 @@
# -----------------------------------------------------------------------------
from __future__ import unicode_literals
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_unused.py b/tests/yacc_unused.py
index 55b677b..7bc6749 100644
--- a/test/yacc_unused.py
+++ b/tests/yacc_unused.py
@@ -3,9 +3,6 @@
#
# A grammar with an unused rule
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_unused_rule.py b/tests/yacc_unused_rule.py
index 4868ef8..2e08d6d 100644
--- a/test/yacc_unused_rule.py
+++ b/tests/yacc_unused_rule.py
@@ -3,9 +3,6 @@
#
# Grammar with an unused rule
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_uprec.py b/tests/yacc_uprec.py
index 569adb8..f173509 100644
--- a/test/yacc_uprec.py
+++ b/tests/yacc_uprec.py
@@ -3,9 +3,6 @@
#
# A grammar with a bad %prec specifier
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens
diff --git a/test/yacc_uprec2.py b/tests/yacc_uprec2.py
index 73274bf..85c0f2f 100644
--- a/test/yacc_uprec2.py
+++ b/tests/yacc_uprec2.py
@@ -3,9 +3,6 @@
#
# A grammar with a bad %prec specifier
# -----------------------------------------------------------------------------
-import sys
-
-if ".." not in sys.path: sys.path.insert(0,"..")
import ply.yacc as yacc
from calclex import tokens