From f9fc7dab717be2c3872b789bc800b0f0e34dd955 Mon Sep 17 00:00:00 2001 From: Kumar Aditya Date: Mon, 27 May 2024 16:17:13 +0530 Subject: [PATCH] fixup tests --- aioshutil/__init__.py | 67 +++++++++++++++-------------------------- tests/conftest.py | 9 ------ tests/test_aioshutil.py | 4 ++- 3 files changed, 28 insertions(+), 52 deletions(-) delete mode 100644 tests/conftest.py diff --git a/aioshutil/__init__.py b/aioshutil/__init__.py index 5b26fea..2ab186d 100644 --- a/aioshutil/__init__.py +++ b/aioshutil/__init__.py @@ -72,32 +72,26 @@ @overload async def copy( src: StrPath, dst: StrPath, *, follow_symlinks: bool = ... - ) -> _PathReturn: - ... + ) -> _PathReturn: ... @overload async def copy( src: BytesPath, dst: BytesPath, *, follow_symlinks: bool = ... - ) -> _PathReturn: - ... + ) -> _PathReturn: ... - async def copy(src, dst, *, follow_symlinks=...): - ... + async def copy(src, dst, *, follow_symlinks=...): ... @overload async def copy2( src: StrPath, dst: StrPath, *, follow_symlinks: bool = ... - ) -> _PathReturn: - ... + ) -> _PathReturn: ... @overload async def copy2( src: BytesPath, dst: BytesPath, *, follow_symlinks: bool = ... - ) -> _PathReturn: - ... + ) -> _PathReturn: ... - async def copy2(src, dst, *, follow_symlinks=...): - ... + async def copy2(src, dst, *, follow_symlinks=...): ... @overload async def register_archive_format( @@ -105,8 +99,7 @@ async def register_archive_format( function: Callable[..., object], extra_args: Sequence[tuple[str, Any] | list[Any]], description: str = ..., - ) -> None: - ... + ) -> None: ... @overload async def register_archive_format( @@ -114,11 +107,11 @@ async def register_archive_format( function: Callable[[str, str], object], extra_args: None = ..., description: str = ..., - ) -> None: - ... + ) -> None: ... - async def register_archive_format(name, function, extra_args=..., description=...): - ... + async def register_archive_format( + name, function, extra_args=..., description=... + ): ... @overload async def register_unpack_format( @@ -127,8 +120,7 @@ async def register_unpack_format( function: Callable[..., object], extra_args: Sequence[tuple[str, Any]], description: str = ..., - ) -> None: - ... + ) -> None: ... @overload async def register_unpack_format( @@ -137,64 +129,55 @@ async def register_unpack_format( function: Callable[[str, str], object], extra_args: None = ..., description: str = ..., - ) -> None: - ... + ) -> None: ... async def register_unpack_format( name, extensions, function, extra_args=..., description=... - ): - ... + ): ... @overload async def chown( path: StrOrBytesPath, user: Union[str, int], group: None = ... - ) -> None: - ... + ) -> None: ... @overload async def chown( path: StrOrBytesPath, user: None = ..., *, group: Union[str, int] - ) -> None: - ... + ) -> None: ... @overload - async def chown(path: StrOrBytesPath, user: None, group: Union[str, int]) -> None: - ... + async def chown( + path: StrOrBytesPath, user: None, group: Union[str, int] + ) -> None: ... @overload async def chown( path: StrOrBytesPath, user: Union[str, int], group: Union[str, int] - ) -> None: - ... + ) -> None: ... - async def chown(path, user=..., group=...): - ... + async def chown(path, user=..., group=...): ... if sys.version_info >= (3, 8): @overload async def which( cmd: _StrPathT, mode: int = ..., path: Optional[StrPath] = ... - ) -> Union[str, _StrPathT, None]: - ... + ) -> Union[str, _StrPathT, None]: ... @overload async def which( cmd: bytes, mode: int = ..., path: Optional[StrPath] = ... - ) -> Optional[bytes]: - ... + ) -> Optional[bytes]: ... async def which( cmd, mode=..., path=... - ) -> Union[bytes, str, StrPath, PathLike[str], None]: - ... + ) -> Union[bytes, str, StrPath, PathLike[str], None]: ... else: async def which( cmd: _StrPathT, mode: int = ..., path: StrPath | None = ... - ) -> str | _StrPathT | None: - ... + ) -> str | _StrPathT | None: ... def sync_to_async(func: Callable[P, R]) -> Callable[P, Coroutine[Any, Any, R]]: diff --git a/tests/conftest.py b/tests/conftest.py deleted file mode 100644 index 9ff0d51..0000000 --- a/tests/conftest.py +++ /dev/null @@ -1,9 +0,0 @@ -# -*- coding: utf-8 -*- -import pytest - - -def pytest_collection_modifyitems(items): - for item in items: - # Only Python tests, not the typing tests - if isinstance(item, pytest.Function): - item.add_marker(pytest.mark.asyncio) diff --git a/tests/test_aioshutil.py b/tests/test_aioshutil.py index 4597451..0137a81 100644 --- a/tests/test_aioshutil.py +++ b/tests/test_aioshutil.py @@ -3,9 +3,11 @@ import os import stat from pathlib import Path - +import pytest import aioshutil +pytestmark = [pytest.mark.asyncio] + async def test_copyfileobj(tmp_path: Path): (tmp_path / "temp.txt").write_text("Hello World!", encoding="utf-8")