moz-sql-parser/tests
Kyle Lahnakoski 1b205e518d Merge branch 'Mozilla-Fixing' of git://github.com/Alberto15Romero/moz-sql-parser into case
# Conflicts:
#	moz_sql_parser/keywords.py
2020-05-24 20:46:53 -04:00
..
README.md Update number of tests 2019-05-04 16:59:33 +05:30
__init__.py first commit 2016-11-13 12:17:53 -05:00
test_errors.py import fixes 2019-11-20 09:04:04 -05:00
test_format_and_parse.py Merge branch 'Mozilla-Fixing' of git://github.com/Alberto15Romero/moz-sql-parser into case 2020-05-24 20:46:53 -04:00
test_formatting.py Fixing test name 2020-04-26 12:25:54 +02:00
test_meta.py fix keyword lint problem 2019-07-23 07:49:50 -04:00
test_resources.py more skipping tests 2019-02-02 22:13:02 -05:00
test_simple.py Testing 2020-03-05 16:50:05 +01:00
util.py updates from other projects 2019-11-20 08:56:25 -05:00

README.md

Moz SQL Parser Tests

The test suite has over 400 tests.

Running Tests

For Linux:

git clone https://github.com/mozilla/moz-sql-parser.git
cd moz-sql-parser
pip install -r requirements.txt
set PYTHONPATH=.	
python -m unittest discover tests

For Windows:

git clone https://github.com/mozilla/moz-sql-parser.git
cd moz-sql-parser
pip install -r requirements.txt
set PYTHONPATH=.	
python.exe -m unittest discover tests

Debugging Suggestions

  • Once you have written a failing test, you can DEBUG=True in the sql_parser.py to print out a trace of matching attempts.
  • If you added more ParserElements, you may want to add .setDebugActions(*debug) to each, so they print out thier matching attempts too.
  • Even though you can use Python strings for literals, they will not be attempted in all cases; wrap as a Literal or Keyword. This problem is known to lurk while matching infixNotation.
  • Feel free to leave in rulers, if you use them

History

  • January 2018 - fixes for Python3
  • July 2017 - Add suite to start testing error messages, with hope of improving them
  • April 2017 - All tests pass
  • March 2017 - Added a number of test cases, most of which are missing the expected JSON parse tree, so they fail.