diff --git a/.github/workflows/build-unstable.yml b/.github/workflows/build-unstable.yml index 7eec186e097..d4c03845512 100644 --- a/.github/workflows/build-unstable.yml +++ b/.github/workflows/build-unstable.yml @@ -36,34 +36,18 @@ jobs: with: node-version: 18.x - - name: Cache node modules - uses: actions/cache@v3 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- - ${{ runner.os }}-build- - ${{ runner.os }}- - - name: setup Miniconda uses: conda-incubator/setup-miniconda@v2 - name: Setup Environment run: make setup + - name: Clean + run: make clean + - name: Build run: make build - - name: TypeScript Tests - run: make test-ts - - - name: Python Tests - run: make test-py - - name: Integration Tests run: make test-integration-parallel diff --git a/pyscriptjs/Makefile b/pyscriptjs/Makefile index 432e2f19003..babe368fab8 100644 --- a/pyscriptjs/Makefile +++ b/pyscriptjs/Makefile @@ -77,6 +77,8 @@ examples: rm -rf ./examples/build mkdir -p ./examples/build cp -R ./build/* ./examples/build + ls ./examples + ls ./examples/build @echo "To serve examples run: $(conda_run) python -m http.server 8080 --directory examples" # run prerequisites and serve pyscript examples at http://localhost:8000/examples/ @@ -87,19 +89,19 @@ run-examples: setup build examples test: make examples - make test-ts - make test-py +# make test-ts +# make test-py make test-integration-parallel test-integration: make examples mkdir -p test_results - $(PYTEST_EXE) -vv $(ARGS) tests/integration/ --log-cli-level=warning --junitxml=test_results/integration.xml + $(PYTEST_EXE) -vv $(ARGS) tests/integration/ --log-cli-level=warning --junitxml=test_results/integration.xml -k 'zz_examples' test-integration-parallel: make examples mkdir -p test_results - $(PYTEST_EXE) --numprocesses auto -vv $(ARGS) tests/integration/ --log-cli-level=warning --junitxml=test_results/integration.xml + $(PYTEST_EXE) --numprocesses auto -vv $(ARGS) tests/integration/ --log-cli-level=warning --junitxml=test_results/integration.xml -k 'zz_examples' test-py: @echo "Tests from $(src_dir)" diff --git a/pyscriptjs/src/main.ts b/pyscriptjs/src/main.ts index 86eaf9e70f7..161d23b06c8 100644 --- a/pyscriptjs/src/main.ts +++ b/pyscriptjs/src/main.ts @@ -23,6 +23,9 @@ import * as Synclink from 'synclink'; const logger = getLogger('pyscript/main'); +// This is a dummy comment for the purposes of this experiment +// This is a second dummy content + /** * Monkey patching the error transfer handler to preserve the `$$isUserError` * marker so as to detect `UserError` subclasses in the error handling code. diff --git a/pyscriptjs/tests/integration/support.py b/pyscriptjs/tests/integration/support.py index 2a6ed1fe6a1..4f4ff29e9b3 100644 --- a/pyscriptjs/tests/integration/support.py +++ b/pyscriptjs/tests/integration/support.py @@ -933,6 +933,7 @@ def log_request(self, status, kind, url): def _router(self, route): full_url = route.request.url + self.logger.log("route", f"Request for {full_url}") url = urllib.parse.urlparse(full_url) assert url.scheme in ("http", "https") @@ -942,9 +943,37 @@ def _router(self, route): self.log_request(200, "fake_server", full_url) assert url.path[0] == "/" relative_path = url.path[1:] + self.logger.log("url", f"{url.path= }") if os.path.exists(relative_path): route.fulfill(status=200, headers=self.headers, path=relative_path) else: + + def printFilesInPath(path): + for file in sorted(os.listdir(path)): + print(">>> ", file) + + def walkFiles(path): + # traverse root directory, and list directories as dirs and files as files + for root, _dirs, files in os.walk("."): + path = root.split(os.sep) + print((len(path) - 1) * "---", os.path.basename(root)) + for file in files: + print(len(path) * "---", file) + + print( + f"This code is executing in file {__file__=} with parent dir {os.path.dirname(__file__)=}" + ) + + enclosing_folder = "/".join(relative_path.split("/")[:-1]) + enclosing_folder = enclosing_folder if enclosing_folder else "." + print( + f"Failed to find '{relative_path} (based on full path {url.path= })'" + ) + print(f"Current working directory is: {os.getcwd()}") + print("Contents of cwd are:") + # walkFiles(os.getcwd()) + print("Contents of {enclosing_folder} :") + printFilesInPath(enclosing_folder) route.fulfill(status=404, headers=self.headers) return diff --git a/pyscriptjs/tests/integration/test_zz_examples.py b/pyscriptjs/tests/integration/test_zz_examples.py index 245a7c1bc0e..c409b8e2c5d 100644 --- a/pyscriptjs/tests/integration/test_zz_examples.py +++ b/pyscriptjs/tests/integration/test_zz_examples.py @@ -37,6 +37,7 @@ def test_hello_world(self): assert re.search(pattern, content) self.assert_no_banners() self.check_tutor_generated_code() + raise AssertionError() def test_simple_clock(self): self.goto("examples/simple_clock.html")