From 5768f4b1fd3fe9ba4a5d43a7b6905158e6c58c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kijewski?= Date: Mon, 8 Jan 2024 18:11:56 +0100 Subject: [PATCH] Move scripts, ship tests --- .github/workflows/ci.yml | 4 ++-- MANIFEST.in | 5 +++-- Makefile | 14 +++++++------- .../make_decoder_recursive_select.py | 0 make_escape_dct.py => scripts/make_escape_dct.py | 0 .../make_unicode_categories.py | 2 +- .../run-minefield-test.py | 4 +++- run-tests.py => scripts/run-tests.py | 4 +++- sha512sum.py => scripts/sha512sum.py | 0 .../transcode-to-json.py | 0 third-party/fast_double_parser | 2 +- 11 files changed, 20 insertions(+), 15 deletions(-) rename make_decoder_recursive_select.py => scripts/make_decoder_recursive_select.py (100%) rename make_escape_dct.py => scripts/make_escape_dct.py (100%) rename make_unicode_categories.py => scripts/make_unicode_categories.py (99%) rename run-minefield-test.py => scripts/run-minefield-test.py (95%) rename run-tests.py => scripts/run-tests.py (95%) rename sha512sum.py => scripts/sha512sum.py (100%) rename transcode-to-json.py => scripts/transcode-to-json.py (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d52fee0..4256c9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/MANIFEST.in b/MANIFEST.in index 3364e20..aa92e5d 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,4 @@ include LICENSE -include make_*.py -include sha512sum.py include Makefile include pyjson5.cpp include pyjson5.pyx @@ -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 ** diff --git a/Makefile b/Makefile index dbbc752..d59f514 100644 --- a/Makefile +++ b/Makefile @@ -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) @@ -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 diff --git a/make_decoder_recursive_select.py b/scripts/make_decoder_recursive_select.py similarity index 100% rename from make_decoder_recursive_select.py rename to scripts/make_decoder_recursive_select.py diff --git a/make_escape_dct.py b/scripts/make_escape_dct.py similarity index 100% rename from make_escape_dct.py rename to scripts/make_escape_dct.py diff --git a/make_unicode_categories.py b/scripts/make_unicode_categories.py similarity index 99% rename from make_unicode_categories.py rename to scripts/make_unicode_categories.py index 23feb63..707224b 100755 --- a/make_unicode_categories.py +++ b/scripts/make_unicode_categories.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python from argparse import ArgumentParser from collections import defaultdict diff --git a/run-minefield-test.py b/scripts/run-minefield-test.py similarity index 95% rename from run-minefield-test.py rename to scripts/run-minefield-test.py index 71cfe85..f631b61 100755 --- a/run-minefield-test.py +++ b/scripts/run-minefield-test.py @@ -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")): @@ -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) diff --git a/run-tests.py b/scripts/run-tests.py similarity index 95% rename from run-tests.py rename to scripts/run-tests.py index a31912c..372d19b 100755 --- a/run-tests.py +++ b/scripts/run-tests.py @@ -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("*/*.*")): @@ -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) diff --git a/sha512sum.py b/scripts/sha512sum.py similarity index 100% rename from sha512sum.py rename to scripts/sha512sum.py diff --git a/transcode-to-json.py b/scripts/transcode-to-json.py similarity index 100% rename from transcode-to-json.py rename to scripts/transcode-to-json.py diff --git a/third-party/fast_double_parser b/third-party/fast_double_parser index d2e8f22..4f5e530 160000 --- a/third-party/fast_double_parser +++ b/third-party/fast_double_parser @@ -1 +1 @@ -Subproject commit d2e8f223e78669218a01210dedb21b3be0beba65 +Subproject commit 4f5e530b02a94ab59cef021a4064852394157b27