Skip to content

Commit

Permalink
Merge pull request #40 from scivisum/circleci-project-setup
Browse files Browse the repository at this point in the history
Circleci project setup
  • Loading branch information
matseymour28590 committed May 17, 2023
2 parents 4f11f7d + 79b000a commit 01a5a60
Show file tree
Hide file tree
Showing 13 changed files with 108 additions and 56 deletions.
60 changes: 60 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
version: 2.1

jobs:
unittests-py38:
docker:
- image: python:3.8.16-bullseye
steps:
- run: git config --global --add safe.directory /tmp/_circleci_local_build_repo
- checkout
- run: pip install -r dev_requirements.txt
- run: pytest tests/unittests --verbose --full-trace
unittests-py311:
docker:
- image: python:3.11.3-bullseye
steps:
- run: git config --global --add safe.directory /tmp/_circleci_local_build_repo
- checkout
- run: pip install -r dev_requirements.txt
- run: pytest tests/unittests --verbose --full-trace
integrationtests-py38:
docker:
- image: python:3.8.16-bullseye
steps:
- run: git config --global --add safe.directory /tmp/_circleci_local_build_repo
- checkout
- run: pip install -r dev_requirements.txt
- run: pytest tests/integrationtests --verbose --full-trace
integrationtests-py311:
docker:
- image: python:3.11.3-bullseye
steps:
- run: git config --global --add safe.directory /tmp/_circleci_local_build_repo
- checkout
- run: pip install -r dev_requirements.txt
- run: pytest tests/integrationtests --verbose --full-trace
e2etests-chrome106-py38:
docker:
- image: matseymour/chrome-python:106.0.5249.61-3.8.16
steps:
- run: git config --global --add safe.directory /tmp/_circleci_local_build_repo
- checkout
- run: pip install -r dev_requirements.txt
- run: tini -s -- xvfb-run pytest tests/e2etests --verbose --full-trace
e2etests-chrome112-py311:
docker:
- image: matseymour/chrome-python:112.0.5615.121-3.11.3
steps:
- run: git config --global --add safe.directory /tmp/_circleci_local_build_repo
- checkout
- run: pip install -r dev_requirements.txt
- run: tini -s -- xvfb-run pytest tests/e2etests --verbose --full-trace
workflows:
test:
jobs:
- unittests-py38
- unittests-py311
- integrationtests-py38
- integrationtests-py311
- e2etests-chrome106-py38
- e2etests-chrome112-py311
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

10 changes: 10 additions & 0 deletions Dockerfile-106-3.8
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM matseymour/chrome-python:106.0.5249.61-3.8.16
ENV PYTHONUNBUFFERED 1

RUN mkdir /code
RUN mkdir /code/tests
RUN mkdir /code/browserdebuggertools
COPY dev_requirements.txt /code
RUN pip install -r /code/dev_requirements.txt

WORKDIR /code/tests
10 changes: 10 additions & 0 deletions Dockerfile-112-3.11
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM matseymour/chrome-python:112.0.5615.121-3.11.3
ENV PYTHONUNBUFFERED 1

RUN mkdir /code
RUN mkdir /code/tests
RUN mkdir /code/browserdebuggertools
COPY dev_requirements.txt /code
RUN pip install -r /code/dev_requirements.txt

WORKDIR /code/tests
11 changes: 5 additions & 6 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
requests
mock
typing
jinja2
websocket-client==0.56
cherrypy==17.4.2
requests==2.29.0
jinja2==3.1.2
pytest==7.3.1
websocket-client==1.5.1
cherrypy==18.8.0
24 changes: 0 additions & 24 deletions scripts/travis.sh

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
classifiers=[
'Intended Audience :: Developers',
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent"
],
Expand Down
15 changes: 15 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
images=$(docker image list)
for VERS in "106-3.8" "112-3.11"
do
matches=$(echo "$images" |grep browser-debugger-tools-test:$VERS)
echo "########### Testing Dockerfile-$VERS ###########"
if [ "$1" == "--build" ] || [ "$matches" == "" ]; then
docker build -f Dockerfile-$VERS -t browser-debugger-tools-test:$VERS .
fi
done
for VERS in "106-3.8" "112-3.11"
do
docker run -v $PWD/tests:/code/tests -v $PWD/browserdebuggertools:/code/browserdebuggertools \
browser-debugger-tools-test:$VERS tini -- xvfb-run pytest .
done
5 changes: 3 additions & 2 deletions tests/e2etests/chrome/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@ def setUpClass(cls):
"--no-default-browser-check",
"--headless" if cls.headless else "",
"--user-data-dir=%s" % cls.browser_cache_dir,
"--no-first-run",
"--no-first-run", "--disable-gpu",
"--no-sandbox", "--remote-allow-origins=*"
])

start = time.time()
while start - time.time() < 30:
while time.time() - start < 30:

time.sleep(3)

Expand Down
2 changes: 1 addition & 1 deletion tests/integrationtests/chrome/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from unittest import TestCase
from base64 import b64encode

from mock import MagicMock, patch
from unittest.mock import MagicMock, patch

from browserdebuggertools.chrome.interface import ChromeInterface
from browserdebuggertools.exceptions import DevToolsTimeoutException
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/chrome/test_interface.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from unittest import TestCase

from mock import patch, MagicMock, call
from unittest.mock import patch, MagicMock, call

from browserdebuggertools.chrome.interface import ChromeInterface, _DOMManager
from browserdebuggertools.exceptions import ResourceNotFoundError
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/test_eventhandlers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from unittest import TestCase

from mock import MagicMock, patch
from unittest.mock import MagicMock, patch

from browserdebuggertools.eventhandlers import PageLoadEventHandler, JavascriptDialogEventHandler
from browserdebuggertools.exceptions import DomainNotEnabledError, JavascriptDialogNotFoundError
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from unittest import TestCase

from mock import MagicMock
from unittest.mock import MagicMock

from browserdebuggertools.exceptions import DevToolsException
from browserdebuggertools.models import JavascriptDialog
Expand Down

0 comments on commit 01a5a60

Please sign in to comment.