Skip to content

Commit d754fc3

Browse files
committed
Adding option to run tests with browser
1 parent f7edc3f commit d754fc3

36 files changed

+88
-24
lines changed

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Install dependencies
2525
run: pipenv install --dev
2626
- name: Linter with pylint
27-
run: pipenv run pylint scraper
27+
run: pipenv run pylint
2828

2929
unit_tests:
3030
strategy:
@@ -44,7 +44,7 @@ jobs:
4444
- name: Install dependencies
4545
run: pipenv install --dev
4646
- name: Run tests
47-
run: pipenv run pytest ./scraper/src -k "not _browser"
47+
run: pipenv run pytest
4848

4949
integration_tests:
5050
strategy:

CONTRIBUTING.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,45 @@ pipenv run pylint scraper
4949
pipenv run pytest ./scraper/src -k "not _browser"
5050
```
5151

52+
If you have chromedriver install you can run the full test suite by passing the path to your
53+
chromedrive
54+
55+
```bash
56+
pipenv run pytest --chromedriver=/path/to/your/chromedriver
57+
```
58+
59+
Where `path/to/your/chromedriver` matches your particular path. If you are unsure of your
60+
chromedriver path you find it on Linux/Mac with:
61+
62+
```bash
63+
which chromedriver
64+
```
65+
66+
Or on Windwos with:
67+
68+
```bash
69+
where chromedriver
70+
```
71+
72+
If you do not have chromedriver installed you can skip the tests that require it by running the
73+
tests with:
74+
75+
```bash
76+
pipenv run pytest -m "not chromedriver"
77+
```
78+
79+
Note that these tests will still run in CI when you submit your pull request.
80+
5281
Optionally tox can be used to run test on all supported version of Python and linting.
5382

5483
```bash
55-
pipenv run tox
84+
pipenv run tox -- --chromedriver=/path/to/your/chromedriver
85+
```
86+
87+
Or to run tox if you don't have chromedriver
88+
89+
```bash
90+
pipenv run tox -- -m "not chromedriver"
5691
```
5792

5893
## Git Guidelines

pytest.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[pytest]
2+
markers =
3+
chromedriver: mark a test as a test using chromedriver.

scraper/src/tests/config_files_examples/docs-basics.config.json renamed to tests/config_files_examples/docs-basics.config.json

File renamed without changes.

scraper/src/tests/config_files_examples/docs-custom.config.json renamed to tests/config_files_examples/docs-custom.config.json

File renamed without changes.
File renamed without changes.
File renamed without changes.

scraper/src/tests/config_loader/anchors_test.py renamed to tests/config_loader/anchors_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# coding: utf-8
2-
from ...config.config_loader import ConfigLoader
2+
from scraper.src.config.config_loader import ConfigLoader
33
from .abstract import config
44

55

scraper/src/tests/config_loader/basic_test.py renamed to tests/config_loader/basic_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# coding: utf-8
2-
from ...config.config_loader import ConfigLoader
2+
from scraper.src.config.config_loader import ConfigLoader
33
from .abstract import config
44
import pytest
55

0 commit comments

Comments
 (0)