Skip to content

Commit

Permalink
configure pytest to be stricter (#1040)
Browse files Browse the repository at this point in the history
* fix tests/test_datastructures::TestUploadFile PytestCollectionWarning

enhance pytest strictness to catch warnings that would have prevented
thest TestUploadFile file warning

restore cov-report and require 100% coverage

* Apply suggestions from code review

Co-authored-by: Jamie Hewland <jhewland@gmail.com>

* remove cov-fail-under

* Apply suggestions from code review

Co-authored-by: Jamie Hewland <jhewland@gmail.com>

* Apply suggestions from code review

Co-authored-by: Jamie Hewland <jhewland@gmail.com>

* Update setup.cfg

Co-authored-by: Jamie Hewland <jhewland@gmail.com>

Co-authored-by: Jamie Hewland <jhewland@gmail.com>
  • Loading branch information
graingert and JayH5 committed Sep 11, 2020
1 parent 7113ee8 commit b043fe5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
18 changes: 17 additions & 1 deletion setup.cfg
Expand Up @@ -16,4 +16,20 @@ profile = black
combine_as_imports = True

[tool:pytest]
addopts = --cov-report= --cov=starlette --cov=tests -rxXs
addopts =
--cov-report=term-missing:skip-covered
--cov=starlette
--cov=tests
-rxXs
--strict-config
--strict-markers
xfail_strict=True
filterwarnings=
# Turn warnings that aren't filtered into exceptions
error
# https://github.com/Tinche/aiofiles/issues/81
ignore: "@coroutine" decorator is deprecated.*:DeprecationWarning
# https://github.com/graphql-python/graphene/issues/1055
ignore: Using or importing the ABCs from 'collections' instead of from 'collections\.abc' is deprecated.*:DeprecationWarning
ignore: The 'context' alias has been deprecated. Please use 'context_value' instead\.:DeprecationWarning
ignore: The 'variables' alias has been deprecated. Please use 'variable_values' instead\.:DeprecationWarning
4 changes: 2 additions & 2 deletions tests/test_datastructures.py
Expand Up @@ -213,13 +213,13 @@ def test_queryparams():
assert QueryParams(q) == q


class TestUploadFile(UploadFile):
class BigUploadFile(UploadFile):
spool_max_size = 1024


@pytest.mark.asyncio
async def test_upload_file():
big_file = TestUploadFile("big-file")
big_file = BigUploadFile("big-file")
await big_file.write(b"big-data" * 512)
await big_file.write(b"big-data")
await big_file.seek(0)
Expand Down

0 comments on commit b043fe5

Please sign in to comment.