Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage #22

Merged
merged 2 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest
python -m pip install --upgrade pip setuptools wheel
python -m pip install coverage pytest
python -m pip install .
- name: Test with pytest
- name: Tests
run: |
pytest
coverage run --branch -m pytest
coverage report --omit='/tmp/*' --fail-under=100
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ $ venv/bin/python -m pytest .

```shell
$ venv/bin/python -m pip install coverage
$ venv/bin/coverage run -m pytest .
$ venv/bin/coverage run --branch -m pytest .
$ venv/bin/coverage html --omit='/private/*'
$ open htmlcov/index.html
```
6 changes: 6 additions & 0 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ def test_build_css_minify_no_css_files(run_start: CliRunner) -> None:
assert re.search(SUCCESS_REGEX, result.output)


def test_build_no_css_minify_no_js_minify(run_start: CliRunner) -> None:
result = run_start.invoke(build, ['--no-css-minify', '--no-js-minify'])
assert result.exit_code == 0
assert re.search(SUCCESS_REGEX, result.output)


def test_build_html_pretty_true(run_start: CliRunner) -> None:
config_path = Path('config.toml')
with config_path.open('r') as config_file:
Expand Down
16 changes: 16 additions & 0 deletions tests/test_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,19 @@ def test_preview(run_start: CliRunner) -> None:
# Why is this 5?
expected_exit_code = 5
assert result.exit_code == expected_exit_code


def test_preview_css_minify_js_minify(run_start: CliRunner) -> None:
run_start.invoke(preview, ['--css-minify', '--js-minify'])


def test_preview_no_css_minify(run_start: CliRunner) -> None:
run_start.invoke(preview, ['--no-css-minify', '--js-minify'])


def test_preview_css_minify_no_js_minify(run_start: CliRunner) -> None:
run_start.invoke(preview, ['--css-minify', '--no-js-minify'])


def test_preview_no_css_minify_no_js_minify(run_start: CliRunner) -> None:
run_start.invoke(preview, ['--no-css-minify', '--no-js-minify'])
Loading