Skip to content
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
16 changes: 14 additions & 2 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,25 @@ jobs:
version: "latest"
python-version: ${{ matrix.python-version }}

- name: Install & Test
- name: Install & Test Defaults
run: |
uv pip install ".[test]"
pytest --cov=doorway tests/
pytest --cov=doorway --color=yes --capture=no --verbose -m 'not extra_test' ./tests/

- name: Install & Test Extras
run: |
uv pip install ".[extras]"
pytest --cov=doorway --color=yes --capture=no --verbose -m 'extra_test' ./tests/

# codecov automatically merges all generated files
- uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false


# # @pytest.mark.remote_test
# # pytest --color=yes --capture=no --verbose -m 'not remote_test'
# # * run pytest on non-remote tests
# - id: pytest
# run: pytest --color=yes --capture=no --verbose -m 'not remote_test'
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ test = [
"pytest-cov>=2",
]

extra = [
extras = [
"rfc3986>=1",
"requests",
"cachier",
Expand Down
9 changes: 9 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@

[pytest]
minversion = 6.0

testpaths =
tests
doorway

python_files =
test.py
test_*.py
__test__*.py

; usage:
; * annotation: `@pytest.mark.extra_test`
; * skip tests: `pytest --color=yes --capture=no --verbose -m 'not extra_test'`
markers =
basic_test: tests that are dependent on default dependencies
extra_test: tests that are dependent on any extra dependencies
16 changes: 10 additions & 6 deletions tests/test_uri.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,15 @@

import pytest

from doorway.x._uri import UriMalformedException
from doorway.x._uri import UriTypeEnum
from doorway.x._uri import uri_parse
from doorway.x._uri import uri_validate


# ========================================================================= #
# TEST UTILS #
# ========================================================================= #


@pytest.mark.extra_test
def test_uri_type_enum():
from doorway.x._uri import UriTypeEnum

assert len(UriTypeEnum) == 4
assert list(UriTypeEnum) == [
UriTypeEnum.FILE,
Expand Down Expand Up @@ -65,7 +62,11 @@ def test_uri_type_enum():
assert UriTypeEnum.URL.name == UriTypeEnum.URL.value


@pytest.mark.extra_test
def test_filename_from_uri():
from doorway.x._uri import UriMalformedException
from doorway.x._uri import uri_validate

# test paths
uri_validate("basename")
uri_validate("basename.ext")
Expand Down Expand Up @@ -116,7 +117,10 @@ def test_filename_from_uri():
uri_validate("http://basename.ext/suffix#fragment?query")


@pytest.mark.extra_test
def test_uri_paths_alt():
from doorway.x._uri import uri_parse

def uri(inp, targ=None):
targ = inp if (targ is None) else targ
assert uri_parse(inp).geturl() == targ
Expand Down