diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e1af74..9d6bb49 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: python-version: ["3.11.10"] - node-version: ["20.18.1"] + node-version: ["20"] steps: - uses: actions/checkout@v4 @@ -46,19 +46,22 @@ jobs: - name: Install example JS dependencies run: cd example && poetry run python manage.py djelm npm elm_programs install - - name: Lint python modules - run: | - poetry run tox -e lint + # - name: Lint python modules + # run: | + # poetry run tox -e lint - - name: Run unit tests - run: | - poetry run tox -e django42 + # - name: Run unit tests + # run: | + # poetry run tox -e django42 - name: Install playwright browser run: poetry run doit install_e2e_browser + - name: Prepare browser tests + run: poetry run doit prepare_e2e_tests & + - name: Run browser tests - run: poetry run doit prepare_e2e_tests & poetry run tox -vvv -e e2e + run: poetry run tox -vvv -e e2e - name: Run browser tests after delete compile run: | diff --git a/dodo.py b/dodo.py index 86ca98a..f897372 100644 --- a/dodo.py +++ b/dodo.py @@ -15,7 +15,7 @@ def task_buildimages(): def task_install_e2e_browser(): "Install playwright browser" - return {"actions": ["playwright install firefox"]} + return {"actions": ["playwright install --with-deps --only-shell"]} def task_run_example(): diff --git a/poetry.lock b/poetry.lock index d04f775..b968af8 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1080,4 +1080,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "bedbf51cc4fb72e6a270f9b19cee2324a25c3e5d7eb67d8558abb203f87c05ef" +content-hash = "430b549740fba2b65fe0d87ae7d76000cbd617cbd128a67d1bdacba07d6e1cc4" diff --git a/pyproject.toml b/pyproject.toml index f088e85..d9e74f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,6 @@ django = ">=4.2.5" watchfiles = "^0.21.0" pydantic = "^2.4.2" aiofiles = "^24.1.0" -tox = "^4.23.2" [tool.poetry.group.test.dependencies] pytest = "^8.0.0" diff --git a/src/djelm/strategy.py b/src/djelm/strategy.py index 823efa4..84c5445 100644 --- a/src/djelm/strategy.py +++ b/src/djelm/strategy.py @@ -377,7 +377,7 @@ def run(self, logger) -> ExitSuccess[None] | ExitFailure[None, StrategyError]: process.exit(1); }} }} - Main().then(() => process.exit()).catch(() => process.exit(1)); + Main().then(() => process.exit()).catch((err) => {{console.error(err); process.exit(1);}}); """ process = SubProcess( ["node", "-e", COMPILE_PROGRAM], @@ -387,7 +387,6 @@ def run(self, logger) -> ExitSuccess[None] | ExitFailure[None, StrategyError]: try: process.open() except Exception as err: - logger.write(str(err)) if self.raise_error: raise err else: diff --git a/src/djelm/subprocess.py b/src/djelm/subprocess.py index cc7b56e..2e80e32 100644 --- a/src/djelm/subprocess.py +++ b/src/djelm/subprocess.py @@ -25,13 +25,11 @@ def open(self): if process.poll() is not None: break for c in iter(lambda: process.stderr.read(), ""): # type:ignore - sys.stderr.write(c.decode("utf-8", "ignore")) - sys.stderr.flush() - # if c.decode("utf-8", "ignore") != "": - # if self.raise_error: - # raise Exception(process.stderr.flush()) - # else: - # sys.stdout.write(c.decode("utf-8", "ignore")) + if c.decode("utf-8", "ignore") != "": + if self.raise_error: + raise Exception(str(process.stderr)) + else: + sys.stdout.write(c.decode("utf-8", "ignore")) break if process.returncode != 0: raise Exception(str(process.stderr)) diff --git a/tox.ini b/tox.ini index a1cb238..8d978a6 100644 --- a/tox.ini +++ b/tox.ini @@ -15,7 +15,7 @@ basepython = python3 description = Run unit tests commands = django42: pytest tests/ --ds=tests.settings {posargs} - e2e: pytest -sv example/tests_e2e/ --ds=example.project.settings --browser=firefox {posargs} + e2e: pytest -sv example/tests_e2e/ --ds=example.project.settings {posargs} lint: ruff check . allowlist_externals = pytest elm