Skip to content

Commit

Permalink
Move scripts, ship tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kijewski committed Jan 8, 2024
1 parent d2fa94e commit 5768f4b
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ jobs:
run: make install

- name: Run JSON5 tests suite
run: python run-tests.py
run: python scripts/run-tests.py

- name: Run "JSON is a Minefield" suite
run: python run-minefield-test.py
run: python scripts/run-minefield-test.py

lint:
runs-on: ubuntu-latest
Expand Down
5 changes: 3 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
include LICENSE
include make_*.py
include sha512sum.py
include Makefile
include pyjson5.cpp
include pyjson5.pyx
Expand All @@ -9,4 +7,7 @@ include requires.txt
include setup.cfg
include third-party/fast_double_parser/include/fast_double_parser.h
recursive-include docs **
recursive-include scripts **
recursive-include src **
recursive-include third-party/json5-tests **
recursive-include third-party/JSONTestSuite/test_parsing **
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ FILES := Makefile MANIFEST.in pyjson5.pyx README.rst setup.py ${INCLUDES}

DerivedGeneralCategory.txt: DerivedGeneralCategory.txt.sha
curl -s -o $@ https://www.unicode.org/Public/15.0.0/ucd/extracted/DerivedGeneralCategory.txt
python sha512sum.py -c $@.sha
python scripts/sha512sum.py -c $@.sha

src/_unicode_cat_of.hpp: DerivedGeneralCategory.txt make_unicode_categories.py
python make_unicode_categories.py $< $@
src/_unicode_cat_of.hpp: DerivedGeneralCategory.txt scripts/make_unicode_categories.py
python scripts/make_unicode_categories.py $< $@

src/_decoder_recursive_select.py.hpp: make_decoder_recursive_select.py
src/_decoder_recursive_select.py.hpp: scripts/make_decoder_recursive_select.py
python $< $@

src/_escape_dct.hpp: make_escape_dct.py
src/_escape_dct.hpp: scripts/make_escape_dct.py
python $< $@

pyjson5.cpp: pyjson5.pyx $(wildcard src/*.pyx) $(wildcard src/*.hpp)
Expand Down Expand Up @@ -55,5 +55,5 @@ clean:

test: wheel
pip install --force dist/pyjson5-*.whl
python run-minefield-test.py
python run-tests.py
python scripts/run-minefield-test.py
python scripts/run-tests.py
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python

from argparse import ArgumentParser
from collections import defaultdict
Expand Down
4 changes: 3 additions & 1 deletion run-minefield-test.py → scripts/run-minefield-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
code_bad = Fore.YELLOW + "BAD"
code_ignored = Fore.BLUE + "IGNORED"

script = str(Path(__file__).absolute().parent / "transcode-to-json.py")

args = argparser.parse_args()
index = 0
for path in sorted(args.tests.glob("?_?*.json")):
Expand All @@ -64,7 +66,7 @@

index += 1
try:
p = Popen((executable, "transcode-to-json.py", str(path)))
p = Popen((executable, script, str(path)))
outcome = p.wait(5)
except Exception:
logger.error("Error while testing: %s", path, exc_info=True)
Expand Down
4 changes: 3 additions & 1 deletion run-tests.py → scripts/run-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
bad = 0
severe = 0

script = str(Path(__file__).absolute().parent / "transcode-to-json.py")

args = argparser.parse_args()
index = 0
for path in sorted(args.tests.glob("*/*.*")):
Expand All @@ -52,7 +54,7 @@
category = path.parent.name
name = path.stem
try:
p = Popen((executable, "transcode-to-json.py", str(path)))
p = Popen((executable, script, str(path)))
outcome = p.wait(5)
except Exception:
logger.error("Error while testing: %s", path, exc_info=True)
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion third-party/fast_double_parser
Submodule fast_double_parser updated 1 files
+3 −6 README.md

0 comments on commit 5768f4b

Please sign in to comment.