mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-03-12 02:31:45 +01:00
separate unit/integration tests
This commit is contained in:
12
.github/workflows/build.yml
vendored
12
.github/workflows/build.yml
vendored
@@ -70,18 +70,26 @@ jobs:
|
||||
|
||||
- name: check code style
|
||||
run: |
|
||||
set -eux
|
||||
|
||||
pdm run lint
|
||||
|
||||
pdm run autopep8 -v --exit-code --recursive --diff kleinanzeigen_bot tests
|
||||
|
||||
- name: run unit tests
|
||||
run: |
|
||||
pdm run utest
|
||||
|
||||
- name: run integration tests
|
||||
run: |
|
||||
set -eux
|
||||
|
||||
case "${{ matrix.os }}" in
|
||||
ubuntu-*)
|
||||
sudo apt-get install -o Acquire::Retries=3 --no-install-recommends -y xvfb
|
||||
xvfb-run pdm run test
|
||||
xvfb-run pdm run itest
|
||||
;;
|
||||
*) pdm run test
|
||||
*) pdm run itest
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
@@ -295,9 +295,12 @@ updated_on: # set automatically
|
||||
> Please read [CONTRIBUTING.md](CONTRIBUTING.md) before contributing code. Thank you!
|
||||
|
||||
- Format source code: `pdm run format`
|
||||
- Running unit tests: `pdm run test`
|
||||
- Running linter: `pdm run lint`
|
||||
- Creating platform-specific executable: `pdm run compile`
|
||||
- Run tests:
|
||||
- unit tests: `pdm run utest`
|
||||
- integration tests: `pdm run itest`
|
||||
- all tests: `pdm run test`
|
||||
- Run linter: `pdm run lint`
|
||||
- Create platform-specific executable: `pdm run compile`
|
||||
- Application bootstrap works like this:
|
||||
```python
|
||||
pdm run app
|
||||
|
||||
@@ -73,7 +73,8 @@ format = "autopep8 --recursive --in-place kleinanzeigen_bot tests"
|
||||
lint = "pylint -v kleinanzeigen_bot tests"
|
||||
scan = "bandit -c pyproject.toml -r kleinanzeigen_bot"
|
||||
test = "python -m pytest --capture=tee-sys -v"
|
||||
|
||||
utest = "python -m pytest --capture=tee-sys -v -m 'not itest'"
|
||||
itest = "python -m pytest --capture=tee-sys -v -m 'itest'"
|
||||
|
||||
#####################
|
||||
# autopep8
|
||||
@@ -91,6 +92,7 @@ ignore = [ # https://github.com/hhatto/autopep8#features
|
||||
]
|
||||
aggressive = 3
|
||||
|
||||
|
||||
#####################
|
||||
# bandit
|
||||
# https://pypi.org/project/bandit/
|
||||
@@ -161,4 +163,7 @@ max-statements = 70
|
||||
#####################
|
||||
[tool.pytest.ini_options]
|
||||
# https://docs.pytest.org/en/stable/reference.html#confval-addopts
|
||||
addopts = "-p no:cacheprovider --doctest-modules --ignore=__pypackages__ --ignore=kleinanzeigen_bot/__main__.py"
|
||||
addopts = "--strict-markers -p no:cacheprovider --doctest-modules --ignore=__pypackages__ --ignore=kleinanzeigen_bot/__main__.py"
|
||||
markers = [
|
||||
"itest: marks a test as an integration test (i.e. a test with external dependencies)"
|
||||
]
|
||||
@@ -2,10 +2,13 @@
|
||||
Copyright (C) 2022 Sebastian Thomschke and contributors
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
"""
|
||||
import pytest
|
||||
|
||||
from kleinanzeigen_bot.selenium_mixin import SeleniumMixin
|
||||
from kleinanzeigen_bot import utils
|
||||
|
||||
|
||||
@pytest.mark.itest
|
||||
def test_webdriver_auto_init():
|
||||
selenium_mixin = SeleniumMixin()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user