Skip to content

Commit 79b000a

Browse files
Add jobs for unittests, integrations tests and e2e tests
- Use an independent and portable python-docker image, rather than relying on CircleCI "orbs". - Possibly some config commonisation could be done later, but we might not stick with CircleCI so I didn't bother now. - Some bug in local CI test runner means git config is needed. - Run unittests, integrationtests and e2etests in parallel. - Keep doing e2e test with Chrome106 and python3.8 for legacy support. - Also do e2e tests for Chrome112 (bdt was recently updated to support it) plus latest version of python. - Use tini, xvfb and adjust chrome args so that we can run it in non-headless mode in containers. - Provide a bash script to make running all tests locally easy.
1 parent d8c1ced commit 79b000a

File tree

8 files changed

+91
-64
lines changed

8 files changed

+91
-64
lines changed

.circleci/config.yml

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,60 @@
1-
# Use the latest 2.1 version of CircleCI pipeline process engine.
2-
# See: https://circleci.com/docs/configuration-reference
31
version: 2.1
42

5-
# Define a job to be invoked later in a workflow.
6-
# See: https://circleci.com/docs/configuration-reference/#jobs
73
jobs:
8-
say-hello:
9-
# Specify the execution environment. You can specify an image from Docker Hub or use one of our convenience images from CircleCI's Developer Hub.
10-
# See: https://circleci.com/docs/configuration-reference/#executor-job
4+
unittests-py38:
115
docker:
12-
- image: cimg/base:stable
13-
# Add steps to the job
14-
# See: https://circleci.com/docs/configuration-reference/#steps
6+
- image: python:3.8.16-bullseye
157
steps:
8+
- run: git config --global --add safe.directory /tmp/_circleci_local_build_repo
169
- checkout
17-
- run:
18-
name: "Say hello"
19-
command: "echo Hello, World!"
20-
21-
# Orchestrate jobs using workflows
22-
# See: https://circleci.com/docs/configuration-reference/#workflows
10+
- run: pip install -r dev_requirements.txt
11+
- run: pytest tests/unittests --verbose --full-trace
12+
unittests-py311:
13+
docker:
14+
- image: python:3.11.3-bullseye
15+
steps:
16+
- run: git config --global --add safe.directory /tmp/_circleci_local_build_repo
17+
- checkout
18+
- run: pip install -r dev_requirements.txt
19+
- run: pytest tests/unittests --verbose --full-trace
20+
integrationtests-py38:
21+
docker:
22+
- image: python:3.8.16-bullseye
23+
steps:
24+
- run: git config --global --add safe.directory /tmp/_circleci_local_build_repo
25+
- checkout
26+
- run: pip install -r dev_requirements.txt
27+
- run: pytest tests/integrationtests --verbose --full-trace
28+
integrationtests-py311:
29+
docker:
30+
- image: python:3.11.3-bullseye
31+
steps:
32+
- run: git config --global --add safe.directory /tmp/_circleci_local_build_repo
33+
- checkout
34+
- run: pip install -r dev_requirements.txt
35+
- run: pytest tests/integrationtests --verbose --full-trace
36+
e2etests-chrome106-py38:
37+
docker:
38+
- image: matseymour/chrome-python:106.0.5249.61-3.8.16
39+
steps:
40+
- run: git config --global --add safe.directory /tmp/_circleci_local_build_repo
41+
- checkout
42+
- run: pip install -r dev_requirements.txt
43+
- run: tini -s -- xvfb-run pytest tests/e2etests --verbose --full-trace
44+
e2etests-chrome112-py311:
45+
docker:
46+
- image: matseymour/chrome-python:112.0.5615.121-3.11.3
47+
steps:
48+
- run: git config --global --add safe.directory /tmp/_circleci_local_build_repo
49+
- checkout
50+
- run: pip install -r dev_requirements.txt
51+
- run: tini -s -- xvfb-run pytest tests/e2etests --verbose --full-trace
2352
workflows:
24-
say-hello-workflow:
53+
test:
2554
jobs:
26-
- say-hello
55+
- unittests-py38
56+
- unittests-py311
57+
- integrationtests-py38
58+
- integrationtests-py311
59+
- e2etests-chrome106-py38
60+
- e2etests-chrome112-py311

.travis.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

Dockerfile-106-3.8

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM matseymour/chrome-python:106.0.5249.61-3.8.16
2+
ENV PYTHONUNBUFFERED 1
3+
4+
RUN mkdir /code
5+
RUN mkdir /code/tests
6+
RUN mkdir /code/browserdebuggertools
7+
COPY dev_requirements.txt /code
8+
RUN pip install -r /code/dev_requirements.txt
9+
10+
WORKDIR /code/tests

Dockerfile-112-3.11

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM matseymour/chrome-python:112.0.5615.121-3.11.3
2+
ENV PYTHONUNBUFFERED 1
3+
4+
RUN mkdir /code
5+
RUN mkdir /code/tests
6+
RUN mkdir /code/browserdebuggertools
7+
COPY dev_requirements.txt /code
8+
RUN pip install -r /code/dev_requirements.txt
9+
10+
WORKDIR /code/tests

scripts/travis.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
classifiers=[
2727
'Intended Audience :: Developers',
2828
"Programming Language :: Python",
29-
"Programming Language :: Python :: 3.8",
29+
"Programming Language :: Python :: 3",
3030
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
3131
"Operating System :: OS Independent"
3232
],

test.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
images=$(docker image list)
3+
for VERS in "106-3.8" "112-3.11"
4+
do
5+
matches=$(echo "$images" |grep browser-debugger-tools-test:$VERS)
6+
echo "########### Testing Dockerfile-$VERS ###########"
7+
if [ "$1" == "--build" ] || [ "$matches" == "" ]; then
8+
docker build -f Dockerfile-$VERS -t browser-debugger-tools-test:$VERS .
9+
fi
10+
done
11+
for VERS in "106-3.8" "112-3.11"
12+
do
13+
docker run -v $PWD/tests:/code/tests -v $PWD/browserdebuggertools:/code/browserdebuggertools \
14+
browser-debugger-tools-test:$VERS tini -- xvfb-run pytest .
15+
done

tests/e2etests/chrome/test_interface.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,12 @@ def setUpClass(cls):
4444
"--no-default-browser-check",
4545
"--headless" if cls.headless else "",
4646
"--user-data-dir=%s" % cls.browser_cache_dir,
47-
"--no-first-run",
47+
"--no-first-run", "--disable-gpu",
48+
"--no-sandbox", "--remote-allow-origins=*"
4849
])
4950

5051
start = time.time()
51-
while start - time.time() < 30:
52+
while time.time() - start < 30:
5253

5354
time.sleep(3)
5455

0 commit comments

Comments
 (0)