From 3ea44b97862071bf60a59dddf6b7ff031cc2ce1c Mon Sep 17 00:00:00 2001 From: Jeff Glass Date: Tue, 16 May 2023 13:43:12 -0500 Subject: [PATCH 01/13] Add a comment --- pyscriptjs/src/main.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyscriptjs/src/main.ts b/pyscriptjs/src/main.ts index 86eaf9e70f7..8a06959ed54 100644 --- a/pyscriptjs/src/main.ts +++ b/pyscriptjs/src/main.ts @@ -23,6 +23,8 @@ import * as Synclink from 'synclink'; const logger = getLogger('pyscript/main'); +// This is a dummy comment for the purposes of this experiment + /** * Monkey patching the error transfer handler to preserve the `$$isUserError` * marker so as to detect `UserError` subclasses in the error handling code. From e3cff23832a836c876f236be537c17a06caa65fb Mon Sep 17 00:00:00 2001 From: Jeff Glass Date: Wed, 17 May 2023 07:59:39 -0500 Subject: [PATCH 02/13] Test 5-17-23 1300 UTC --- pyscriptjs/src/main.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/pyscriptjs/src/main.ts b/pyscriptjs/src/main.ts index 8a06959ed54..161d23b06c8 100644 --- a/pyscriptjs/src/main.ts +++ b/pyscriptjs/src/main.ts @@ -24,6 +24,7 @@ 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` From 382f647b5e42d36bf269626524c08896a1a87698 Mon Sep 17 00:00:00 2001 From: Jeff Glass Date: Thu, 18 May 2023 08:07:59 -0500 Subject: [PATCH 03/13] Print examples folder after build --- pyscriptjs/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyscriptjs/Makefile b/pyscriptjs/Makefile index 432e2f19003..97d377ed371 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/ From ca4d9991a2bc64e5acfeeecbfec83d4cf1972649 Mon Sep 17 00:00:00 2001 From: Jeff Glass Date: Thu, 18 May 2023 08:50:23 -0500 Subject: [PATCH 04/13] Add 'make clean' --- .github/workflows/build-unstable.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-unstable.yml b/.github/workflows/build-unstable.yml index 7eec186e097..e719a0a8319 100644 --- a/.github/workflows/build-unstable.yml +++ b/.github/workflows/build-unstable.yml @@ -55,6 +55,9 @@ jobs: - name: Setup Environment run: make setup + - name: Clean + run: make clean + - name: Build run: make build From 8b96d6a052a0b2c3f14afd67fc5c169ddcb1a8f8 Mon Sep 17 00:00:00 2001 From: Jeff Glass Date: Thu, 18 May 2023 09:13:53 -0500 Subject: [PATCH 05/13] Do not cache node modules --- .github/workflows/build-unstable.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.github/workflows/build-unstable.yml b/.github/workflows/build-unstable.yml index e719a0a8319..f30cd6ecfbd 100644 --- a/.github/workflows/build-unstable.yml +++ b/.github/workflows/build-unstable.yml @@ -36,19 +36,6 @@ 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 From 4dad5288ce1e45b3848f7f90ed0299a511b09c98 Mon Sep 17 00:00:00 2001 From: Jeff Glass Date: Thu, 18 May 2023 09:57:28 -0500 Subject: [PATCH 06/13] Only run examples, add logging --- pyscriptjs/Makefile | 8 ++++---- pyscriptjs/tests/integration/support.py | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pyscriptjs/Makefile b/pyscriptjs/Makefile index 97d377ed371..babe368fab8 100644 --- a/pyscriptjs/Makefile +++ b/pyscriptjs/Makefile @@ -89,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/tests/integration/support.py b/pyscriptjs/tests/integration/support.py index 2a6ed1fe6a1..08b776fc44d 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,6 +943,7 @@ 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: From 423b27bb6764bab8541b467fe171123a1a7f39d3 Mon Sep 17 00:00:00 2001 From: Jeff Glass Date: Thu, 18 May 2023 10:27:29 -0500 Subject: [PATCH 07/13] More logging --- pyscriptjs/tests/integration/support.py | 7 +++++++ pyscriptjs/tests/integration/test_zz_examples.py | 1 + 2 files changed, 8 insertions(+) diff --git a/pyscriptjs/tests/integration/support.py b/pyscriptjs/tests/integration/support.py index 08b776fc44d..bdf5eedbcb8 100644 --- a/pyscriptjs/tests/integration/support.py +++ b/pyscriptjs/tests/integration/support.py @@ -947,6 +947,13 @@ def _router(self, route): if os.path.exists(relative_path): route.fulfill(status=200, headers=self.headers, path=relative_path) else: + 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= })'.\nContents of {enclosing_folder} :" + ) + for file in sorted(os.listdir(enclosing_folder)): + print(file) 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") From df3538aa4818efc7b18e1b9031e3a2eccde11fdc Mon Sep 17 00:00:00 2001 From: Jeff Glass Date: Thu, 18 May 2023 10:34:48 -0500 Subject: [PATCH 08/13] Even more logging --- pyscriptjs/tests/integration/support.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pyscriptjs/tests/integration/support.py b/pyscriptjs/tests/integration/support.py index bdf5eedbcb8..3f7dcfaaab0 100644 --- a/pyscriptjs/tests/integration/support.py +++ b/pyscriptjs/tests/integration/support.py @@ -947,13 +947,21 @@ def _router(self, route): 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) + 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= })'.\nContents of {enclosing_folder} :" + f"Failed to find '{relative_path} (based on full path {url.path= })'" ) - for file in sorted(os.listdir(enclosing_folder)): - print(file) + print(f"Current working directory is: {os.getcwd()}") + print("Contents of cwd are:") + printFilesInPath(os.getcwd()) + print("Contents of {enclosing_folder} :") + printFilesInPath(enclosing_folder) route.fulfill(status=404, headers=self.headers) return From f91f371aad4cf551a4a94cf1f261a53523f7d270 Mon Sep 17 00:00:00 2001 From: Jeff Glass Date: Thu, 18 May 2023 10:42:25 -0500 Subject: [PATCH 09/13] Walk path --- pyscriptjs/tests/integration/support.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pyscriptjs/tests/integration/support.py b/pyscriptjs/tests/integration/support.py index 3f7dcfaaab0..83a145cfc46 100644 --- a/pyscriptjs/tests/integration/support.py +++ b/pyscriptjs/tests/integration/support.py @@ -952,6 +952,16 @@ def printFilesInPath(path): for file in sorted(os.listdir(path)): print(">>> ", file) + import os + + 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) + enclosing_folder = "/".join(relative_path.split("/")[:-1]) enclosing_folder = enclosing_folder if enclosing_folder else "." print( @@ -959,7 +969,7 @@ def printFilesInPath(path): ) print(f"Current working directory is: {os.getcwd()}") print("Contents of cwd are:") - printFilesInPath(os.getcwd()) + walkFiles(os.getcwd()) print("Contents of {enclosing_folder} :") printFilesInPath(enclosing_folder) route.fulfill(status=404, headers=self.headers) From 514c197b5008b70e85c89d6ebbe593636fb5c4f3 Mon Sep 17 00:00:00 2001 From: Jeff Glass Date: Thu, 18 May 2023 10:49:15 -0500 Subject: [PATCH 10/13] Fix os import --- pyscriptjs/tests/integration/support.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pyscriptjs/tests/integration/support.py b/pyscriptjs/tests/integration/support.py index 83a145cfc46..f0eb316411f 100644 --- a/pyscriptjs/tests/integration/support.py +++ b/pyscriptjs/tests/integration/support.py @@ -952,8 +952,6 @@ def printFilesInPath(path): for file in sorted(os.listdir(path)): print(">>> ", file) - import os - def walkFiles(path): # traverse root directory, and list directories as dirs and files as files for root, _dirs, files in os.walk("."): From 46efda5802245766873c2c347e9e4973e441a936 Mon Sep 17 00:00:00 2001 From: Jeff Glass Date: Thu, 18 May 2023 10:49:32 -0500 Subject: [PATCH 11/13] Kill other tests --- .github/workflows/build-unstable.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/build-unstable.yml b/.github/workflows/build-unstable.yml index f30cd6ecfbd..d4c03845512 100644 --- a/.github/workflows/build-unstable.yml +++ b/.github/workflows/build-unstable.yml @@ -48,12 +48,6 @@ jobs: - 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 From a36481135f4158a0df6ad74b5f28623d0e954562 Mon Sep 17 00:00:00 2001 From: Jeff Glass Date: Thu, 18 May 2023 11:04:00 -0500 Subject: [PATCH 12/13] Serialize --- .github/workflows/build-unstable.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-unstable.yml b/.github/workflows/build-unstable.yml index d4c03845512..83e2b6b6338 100644 --- a/.github/workflows/build-unstable.yml +++ b/.github/workflows/build-unstable.yml @@ -49,7 +49,7 @@ jobs: run: make build - name: Integration Tests - run: make test-integration-parallel + run: make test-integration - uses: actions/upload-artifact@v3 with: From 8c495f437b77fb42a7639698fca802c6fd4f903d Mon Sep 17 00:00:00 2001 From: Jeff Glass Date: Thu, 18 May 2023 11:18:34 -0500 Subject: [PATCH 13/13] Rerun parallel tests --- .github/workflows/build-unstable.yml | 2 +- pyscriptjs/tests/integration/support.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-unstable.yml b/.github/workflows/build-unstable.yml index 83e2b6b6338..d4c03845512 100644 --- a/.github/workflows/build-unstable.yml +++ b/.github/workflows/build-unstable.yml @@ -49,7 +49,7 @@ jobs: run: make build - name: Integration Tests - run: make test-integration + run: make test-integration-parallel - uses: actions/upload-artifact@v3 with: diff --git a/pyscriptjs/tests/integration/support.py b/pyscriptjs/tests/integration/support.py index f0eb316411f..4f4ff29e9b3 100644 --- a/pyscriptjs/tests/integration/support.py +++ b/pyscriptjs/tests/integration/support.py @@ -960,6 +960,10 @@ def walkFiles(path): 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( @@ -967,7 +971,7 @@ def walkFiles(path): ) print(f"Current working directory is: {os.getcwd()}") print("Contents of cwd are:") - walkFiles(os.getcwd()) + # walkFiles(os.getcwd()) print("Contents of {enclosing_folder} :") printFilesInPath(enclosing_folder) route.fulfill(status=404, headers=self.headers)