next integration tests (#1712)

* move integration tests pyscriptjs/tests/integration ->pyscript.core/tests/integration

* add information in regards to how to run integration tests to README

* fix fake server build paths

* fix paths to build and run tests. The change of path before integration tests is a glitch maybe due to pytest cache?

* remove test files created by mistake

* update readme with latest changes

---------

Co-authored-by: Fabio Pliger <fpliger@anaconda.com>
This commit is contained in:
Fabio Pliger
2023-09-15 14:09:07 -07:00
committed by GitHub
parent ed6de66c08
commit f77241e977
28 changed files with 24 additions and 5 deletions

View File

@@ -36,7 +36,7 @@ check-npm:
setup:
make check-node
make check-npm
# npm install
cd pyscript.core && npm install && cd ..
$(CONDA_EXE) env $(shell [ -d $(env) ] && echo update || echo create) -p $(env) --file environment.yml
$(conda_run) playwright install
$(CONDA_EXE) install -c anaconda pytest -y
@@ -91,9 +91,11 @@ test:
make test-examples
# run all integration tests *including examples* sequentially
# TODO: (fpliger) The cd pyscript.core before running the tests shouldn't be needed but for
# but for some reason it seems to bother pytest tmppaths (or test cache?). Unclear.
test-integration:
mkdir -p test_results
$(PYTEST_EXE) -vv $(ARGS) pyscriptjs/tests/integration/ --log-cli-level=warning --junitxml=test_results/integration.xml
cd pyscript.core && $(PYTEST_EXE) -vv $(ARGS) tests/integration/ --log-cli-level=warning --junitxml=../integration.xml
# run all integration tests *except examples* in parallel (examples use too much memory)
test-integration-parallel:

View File

@@ -27,6 +27,23 @@ Accordingly, whenever a file contains this warning at its first line, please do
// ⚠️ This file is an artifact: DO NOT MODIFY
```
### Running tests
Before running the tests, we need to create a tests environment first. To do so run the following command from the root folder of the project:
```
make setup
```
This will create a tests environment [in the root of the project, named `./env`]and install all the dependencies needed to run the tests.
After the command has completed and the tests environment has been created, you can run the **integration tests** with
the following command:
```
make test-integration
```
## `pyscript` python package
The `pyscript` package available in _Python_ lives in the folder `src/stdlib/pyscript/`.

View File

@@ -16,7 +16,7 @@ import toml
from playwright.sync_api import Error as PlaywrightError
ROOT = py.path.local(__file__).dirpath("..", "..", "..")
BUILD = ROOT.join("pyscript.core")
BUILD = ROOT.join("pyscript.core").join("dist")
def params_with_marks(params):
@@ -504,10 +504,10 @@ class PyScriptTest:
doc = f"""
<html>
<head>
<link rel="stylesheet" href="{self.http_server_addr}/build/dist/core.css">
<link rel="stylesheet" href="{self.http_server_addr}/build/core.css">
<script
type="module"
src="{self.http_server_addr}/build/dist/core.js"
src="{self.http_server_addr}/build/core.js"
></script>
{extra_head}
</head>

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB