From 89cebd5aa66008d0aed04f4c4a8c9840a673250f Mon Sep 17 00:00:00 2001 From: Kai Mueller <15907922+kasium@users.noreply.github.com> Date: Fri, 9 Jul 2021 08:04:34 +0000 Subject: [PATCH 01/13] Add pytest-lazyfixture stubs This change will add stubs for pytest-lazyfixture. It is particual useful for projects which type their tests and use pytest-lazyfixture. The included functions and classes are the scope which can be considered documented by the module. Any other function is related to pytest hook implementations and are normally not called by an user. Please note, that if a user uses 'pytest.lazy_fixture' these stubs will not work. As recommneded in https://github.com/TvoroG/pytest-lazy-fixture/issues/51 the package needs to imported directly. --- stubs/pytest-lazyfixture/METADATA.toml | 1 + stubs/pytest-lazyfixture/pytest_lazyfixture.pyi | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 stubs/pytest-lazyfixture/METADATA.toml create mode 100644 stubs/pytest-lazyfixture/pytest_lazyfixture.pyi diff --git a/stubs/pytest-lazyfixture/METADATA.toml b/stubs/pytest-lazyfixture/METADATA.toml new file mode 100644 index 000000000000..22cbe4eb9ca3 --- /dev/null +++ b/stubs/pytest-lazyfixture/METADATA.toml @@ -0,0 +1 @@ +version = "0.6" diff --git a/stubs/pytest-lazyfixture/pytest_lazyfixture.pyi b/stubs/pytest-lazyfixture/pytest_lazyfixture.pyi new file mode 100644 index 000000000000..619b00f2c1f6 --- /dev/null +++ b/stubs/pytest-lazyfixture/pytest_lazyfixture.pyi @@ -0,0 +1,10 @@ +from typing import Any, Iterable, List + +class LazyFixture: + name: str + def __init__(self, name: str) -> None: ... + def __eq__(self, other): ... + +def lazy_fixture(names: str | Iterable[str]) -> LazyFixture | List[LazyFixture]: ... +def is_lazy_fixture(val: Any) -> bool: ... +def pytest_configure() -> None: ... From 6627be6717a42764b4d9ad818125be0b418f0a84 Mon Sep 17 00:00:00 2001 From: Kai Mueller <15907922+kasium@users.noreply.github.com> Date: Fri, 9 Jul 2021 08:08:15 +0000 Subject: [PATCH 02/13] Add missing types --- stubs/pytest-lazyfixture/pytest_lazyfixture.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/pytest-lazyfixture/pytest_lazyfixture.pyi b/stubs/pytest-lazyfixture/pytest_lazyfixture.pyi index 619b00f2c1f6..becfa3189073 100644 --- a/stubs/pytest-lazyfixture/pytest_lazyfixture.pyi +++ b/stubs/pytest-lazyfixture/pytest_lazyfixture.pyi @@ -3,7 +3,7 @@ from typing import Any, Iterable, List class LazyFixture: name: str def __init__(self, name: str) -> None: ... - def __eq__(self, other): ... + def __eq__(self, other: LazyFixture) -> bool: ... def lazy_fixture(names: str | Iterable[str]) -> LazyFixture | List[LazyFixture]: ... def is_lazy_fixture(val: Any) -> bool: ... From 12aa864936d029042f8469931822600d35cc85ec Mon Sep 17 00:00:00 2001 From: Kai Mueller <15907922+kasium@users.noreply.github.com> Date: Fri, 9 Jul 2021 08:41:36 +0000 Subject: [PATCH 03/13] Rename --- .../{pytest_lazyfixture.pyi => pytest-lazy-fixture.pyi} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename stubs/pytest-lazyfixture/{pytest_lazyfixture.pyi => pytest-lazy-fixture.pyi} (100%) diff --git a/stubs/pytest-lazyfixture/pytest_lazyfixture.pyi b/stubs/pytest-lazyfixture/pytest-lazy-fixture.pyi similarity index 100% rename from stubs/pytest-lazyfixture/pytest_lazyfixture.pyi rename to stubs/pytest-lazyfixture/pytest-lazy-fixture.pyi From 9d066a6c2f0db26749de520ec151573285cce6dd Mon Sep 17 00:00:00 2001 From: Kai Mueller <15907922+kasium@users.noreply.github.com> Date: Fri, 9 Jul 2021 08:43:41 +0000 Subject: [PATCH 04/13] Rename 2 --- .../{pytest-lazy-fixture.pyi => pytest_lazy_fixture.pyi} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename stubs/pytest-lazyfixture/{pytest-lazy-fixture.pyi => pytest_lazy_fixture.pyi} (100%) diff --git a/stubs/pytest-lazyfixture/pytest-lazy-fixture.pyi b/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi similarity index 100% rename from stubs/pytest-lazyfixture/pytest-lazy-fixture.pyi rename to stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi From b96fa2ad525d55b78070ddc93b559bc49d4c7632 Mon Sep 17 00:00:00 2001 From: Kai Mueller <15907922+kasium@users.noreply.github.com> Date: Fri, 9 Jul 2021 08:46:21 +0000 Subject: [PATCH 05/13] Add getattr --- stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi b/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi index becfa3189073..650404dda990 100644 --- a/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi +++ b/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi @@ -8,3 +8,4 @@ class LazyFixture: def lazy_fixture(names: str | Iterable[str]) -> LazyFixture | List[LazyFixture]: ... def is_lazy_fixture(val: Any) -> bool: ... def pytest_configure() -> None: ... +def __getattr__(name: str) -> Any: ... # incomplete From ef33080fb0c2b98099876d81037326b48e046f2a Mon Sep 17 00:00:00 2001 From: Kai Mueller <15907922+kasium@users.noreply.github.com> Date: Fri, 9 Jul 2021 08:49:47 +0000 Subject: [PATCH 06/13] Use overload --- stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi b/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi index 650404dda990..c33ce319010e 100644 --- a/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi +++ b/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi @@ -1,11 +1,14 @@ -from typing import Any, Iterable, List +from typing import Any, Iterable, overload class LazyFixture: name: str def __init__(self, name: str) -> None: ... def __eq__(self, other: LazyFixture) -> bool: ... -def lazy_fixture(names: str | Iterable[str]) -> LazyFixture | List[LazyFixture]: ... +@overload +def lazy_fixture(names: str) -> LazyFixture: ... +@overload +def lazy_fixture(names: Iterable[str]) -> list[LazyFixture]: ... def is_lazy_fixture(val: Any) -> bool: ... def pytest_configure() -> None: ... def __getattr__(name: str) -> Any: ... # incomplete From 29579eb922b4e69c0e4a02dfbd113f932dd1c0df Mon Sep 17 00:00:00 2001 From: Kai Mueller <15907922+kasium@users.noreply.github.com> Date: Fri, 9 Jul 2021 09:20:31 +0000 Subject: [PATCH 07/13] fix --- stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi b/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi index c33ce319010e..37066c4a66a5 100644 --- a/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi +++ b/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi @@ -3,7 +3,7 @@ from typing import Any, Iterable, overload class LazyFixture: name: str def __init__(self, name: str) -> None: ... - def __eq__(self, other: LazyFixture) -> bool: ... + def __getattr__(self, name: str) -> Any: ... # incomplete @overload def lazy_fixture(names: str) -> LazyFixture: ... From dc0bf19c8a98ba9c3eb1d9585f8671564e93ce66 Mon Sep 17 00:00:00 2001 From: Kai Mueller <15907922+kasium@users.noreply.github.com> Date: Fri, 9 Jul 2021 09:23:51 +0000 Subject: [PATCH 08/13] Fix --- stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi b/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi index 37066c4a66a5..e817dfe93a49 100644 --- a/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi +++ b/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi @@ -3,7 +3,7 @@ from typing import Any, Iterable, overload class LazyFixture: name: str def __init__(self, name: str) -> None: ... - def __getattr__(self, name: str) -> Any: ... # incomplete + def __eq__(self, other: object) -> bool: ... @overload def lazy_fixture(names: str) -> LazyFixture: ... From a7814ee8e71b8d9f39838771e5c0eca09d4b5d5f Mon Sep 17 00:00:00 2001 From: Kai Mueller <15907922+kasium@users.noreply.github.com> Date: Fri, 9 Jul 2021 09:27:59 +0000 Subject: [PATCH 09/13] fix --- stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi b/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi index e817dfe93a49..d00503ae05c4 100644 --- a/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi +++ b/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi @@ -1,4 +1,4 @@ -from typing import Any, Iterable, overload +from typing import Any, overload class LazyFixture: name: str @@ -8,7 +8,7 @@ class LazyFixture: @overload def lazy_fixture(names: str) -> LazyFixture: ... @overload -def lazy_fixture(names: Iterable[str]) -> list[LazyFixture]: ... +def lazy_fixture(names: list[str]) -> list[LazyFixture]: ... def is_lazy_fixture(val: Any) -> bool: ... def pytest_configure() -> None: ... def __getattr__(name: str) -> Any: ... # incomplete From 8ea06663299ac08858c91e32545c1ab90e1d83c7 Mon Sep 17 00:00:00 2001 From: kasium <15907922+kasium@users.noreply.github.com> Date: Fri, 9 Jul 2021 11:35:43 +0200 Subject: [PATCH 10/13] Update stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi Co-authored-by: Akuli --- stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi b/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi index d00503ae05c4..9c42ec472348 100644 --- a/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi +++ b/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi @@ -8,7 +8,7 @@ class LazyFixture: @overload def lazy_fixture(names: str) -> LazyFixture: ... @overload -def lazy_fixture(names: list[str]) -> list[LazyFixture]: ... +def lazy_fixture(names: Iterable[str]) -> list[LazyFixture] | Any: ... def is_lazy_fixture(val: Any) -> bool: ... def pytest_configure() -> None: ... def __getattr__(name: str) -> Any: ... # incomplete From 91e8c33cf7d925521991279b774666f0ae8871bc Mon Sep 17 00:00:00 2001 From: Akuli Date: Fri, 9 Jul 2021 12:37:02 +0300 Subject: [PATCH 11/13] Update stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi --- stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi b/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi index 9c42ec472348..b5cc42079cb1 100644 --- a/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi +++ b/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi @@ -1,4 +1,4 @@ -from typing import Any, overload +from typing import Any, Iterable, overload class LazyFixture: name: str From fe6153d77d49d83c476fc14ec27eb8ac766e6084 Mon Sep 17 00:00:00 2001 From: Kai Mueller <15907922+kasium@users.noreply.github.com> Date: Fri, 9 Jul 2021 09:37:55 +0000 Subject: [PATCH 12/13] Rename folder --- stubs/{pytest-lazyfixture => pytest-lazy-fixture}/METADATA.toml | 0 .../pytest_lazy_fixture.pyi | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename stubs/{pytest-lazyfixture => pytest-lazy-fixture}/METADATA.toml (100%) rename stubs/{pytest-lazyfixture => pytest-lazy-fixture}/pytest_lazy_fixture.pyi (100%) diff --git a/stubs/pytest-lazyfixture/METADATA.toml b/stubs/pytest-lazy-fixture/METADATA.toml similarity index 100% rename from stubs/pytest-lazyfixture/METADATA.toml rename to stubs/pytest-lazy-fixture/METADATA.toml diff --git a/stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi b/stubs/pytest-lazy-fixture/pytest_lazy_fixture.pyi similarity index 100% rename from stubs/pytest-lazyfixture/pytest_lazy_fixture.pyi rename to stubs/pytest-lazy-fixture/pytest_lazy_fixture.pyi From 927bb4062024aae083b9d9fe0fb67b17aa7b3ea5 Mon Sep 17 00:00:00 2001 From: Kai Mueller <15907922+kasium@users.noreply.github.com> Date: Fri, 9 Jul 2021 09:43:51 +0000 Subject: [PATCH 13/13] Rename file --- .../{pytest_lazy_fixture.pyi => pytest_lazyfixture.pyi} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename stubs/pytest-lazy-fixture/{pytest_lazy_fixture.pyi => pytest_lazyfixture.pyi} (100%) diff --git a/stubs/pytest-lazy-fixture/pytest_lazy_fixture.pyi b/stubs/pytest-lazy-fixture/pytest_lazyfixture.pyi similarity index 100% rename from stubs/pytest-lazy-fixture/pytest_lazy_fixture.pyi rename to stubs/pytest-lazy-fixture/pytest_lazyfixture.pyi