fix-docker (#10)
* fix docker -> use "pip install -e ." in installation -> add symlinks in docker image -> docker / non docker execution can run same main.py + cli * remove sh scripts * remove requirements.txt Reviewed-on: local-it-infrastructure/e2e_tests#10 Co-authored-by: Daniel <d.brummerloh@gmail.com> Co-committed-by: Daniel <d.brummerloh@gmail.com>
This commit is contained in:
parent
8685688698
commit
d2cfc089c3
8 changed files with 26 additions and 37 deletions
10
Dockerfile
10
Dockerfile
|
|
@ -6,7 +6,13 @@ RUN playwright install
|
|||
|
||||
RUN playwright install-deps
|
||||
|
||||
COPY ./requirements.txt ./
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
COPY . /code
|
||||
|
||||
WORKDIR /code
|
||||
|
||||
RUN pip install --no-cache-dir -e .
|
||||
|
||||
RUN rm -rf /code
|
||||
|
||||
RUN ln -s /code/recipes /recipes
|
||||
RUN ln -s /code/envfiles /envfiles
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ You can run pytest-abra with and without Docker. Choose now and follow the steps
|
|||
Create a python environment and install all dependencies via
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
pip install -e .
|
||||
playwright install
|
||||
```
|
||||
|
||||
|
|
@ -40,7 +40,8 @@ python main.py
|
|||
|
||||
```bash
|
||||
docker compose build # build the image
|
||||
docker compose run --rm app ./run_pytest-abra.sh # run pytest-abra
|
||||
docker compose run --rm app python main.py # run pytest-abra
|
||||
docker compose run --rm -it app /bin/bash # debug the container
|
||||
```
|
||||
|
||||
Force rebuild with cache
|
||||
|
|
@ -49,7 +50,7 @@ Force rebuild with cache
|
|||
docker-compose up --build
|
||||
```
|
||||
|
||||
Force rebuild wtihtout cache
|
||||
Force rebuild without cache
|
||||
|
||||
```bash
|
||||
docker-compose build --no-cache
|
||||
|
|
@ -68,5 +69,5 @@ playwright codegen demo.playwright.dev/todomvc
|
|||
```bash
|
||||
pytest # test pytest-abra
|
||||
pytest --collect-only # debug test pytest-abra
|
||||
docker compose run --rm app ./test_pytest-abra.sh # test pytest-abra
|
||||
docker compose run --rm app pytest # run pytest-abra
|
||||
```
|
||||
|
|
|
|||
7
main.py
7
main.py
|
|
@ -31,6 +31,13 @@ ENV_PATHS = ";".join([x.as_posix() for x in ENV_FILES])
|
|||
RECIPES_DIR = Path("../recipes").resolve()
|
||||
OUTPUT_DIR = Path("./test-output").resolve()
|
||||
|
||||
# -------------------------------- pythonpath -------------------------------- #
|
||||
|
||||
# add recipes dir to pythonpath, so that python imports from there are possible
|
||||
# the custom classes of Runner will be imported from there
|
||||
os.environ["PYTHONPATH"] = RECIPES_DIR.as_posix()
|
||||
|
||||
# ------------------------------------ run ----------------------------------- #
|
||||
|
||||
subprocess.run(
|
||||
[
|
||||
|
|
|
|||
|
|
@ -25,10 +25,8 @@ dependencies = [
|
|||
"icecream",
|
||||
]
|
||||
|
||||
[project.entry_points]
|
||||
pytest11 = [
|
||||
"pytest_abra = pytest_abra.pytest_abra",
|
||||
]
|
||||
[project.entry-points.pytest11]
|
||||
pytest_abra = "pytest_abra.pytest_abra"
|
||||
|
||||
[project.scripts]
|
||||
abratest = "pytest_abra.cli:run"
|
||||
|
|
|
|||
|
|
@ -11,14 +11,13 @@ from pytest_abra.utils import get_datetime_string
|
|||
|
||||
def run():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--env_paths", type=str, help="List of loaded env files separated with ;")
|
||||
parser.add_argument("--recipes_dir", type=Path, help="List of loaded env files separated with ;")
|
||||
parser.add_argument("--output_dir", type=Path, help="List of loaded env files separated with ;")
|
||||
parser.add_argument("--env_paths", type=str, help="List of loaded env files separated with ;", required=True)
|
||||
parser.add_argument("--recipes_dir", type=Path, help="List of loaded env files separated with ;", required=True)
|
||||
parser.add_argument("--output_dir", type=Path, help="List of loaded env files separated with ;", required=True)
|
||||
parser.add_argument("--timeout", type=int, help="Set Playwright timeout in ms", default=20_000)
|
||||
parser.add_argument("--debug", action="store_true", help="Enable Playwright debug mode")
|
||||
parser.add_argument("--resume", action="store_true", help="Re-run the most recent test, skipping passed tests")
|
||||
args = parser.parse_args()
|
||||
|
||||
ENV_FILES = [Path(s) for s in args.env_paths.split(";")]
|
||||
|
||||
# -------------------------- enable playwright debug ------------------------- #
|
||||
|
|
|
|||
|
|
@ -1,9 +0,0 @@
|
|||
pytest
|
||||
pytest-html
|
||||
pytest-playwright
|
||||
python-dotenv
|
||||
icecream
|
||||
loguru
|
||||
beautifulsoup4
|
||||
imbox
|
||||
hatchling
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
RECIPES_PATH=$PWD/recipes
|
||||
export PYTHONPATH=${PYTHONPATH}:$RECIPES_PATH
|
||||
|
||||
python main.py
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
PWD_PATH=$PWD
|
||||
RECIPES_PATH=$PWD/recipes
|
||||
export PYTHONPATH=$PWD_PATH:$RECIPES_PATH
|
||||
|
||||
pytest
|
||||
Loading…
Add table
Add a link
Reference in a new issue