Skip to content

Commit

Permalink
Do not duplicate nox.Session interface in type stubs (#391)
Browse files Browse the repository at this point in the history
* Do not duplicate nox.Session interface in type stubs

* mypy: Ignore [attr-defined] for private attribute access in test
  • Loading branch information
cjolowicz authored Jun 11, 2021
1 parent 101d084 commit 809db93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 36 deletions.
38 changes: 3 additions & 35 deletions src/nox_poetry/sessions.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -26,45 +26,13 @@ class _PoetrySession:
def export_requirements(self) -> Path: ...
def build_package(self, *, distribution_format: str = ...) -> str: ...

class Session:
poetry: _PoetrySession
_session: nox.Session
_runner: nox.sessions.SessionRunner
class Session(nox.Session):
def __init__(self, session: nox.Session) -> None: ...
def install(self, *args: str, **kwargs: Any) -> None: ...
@property
def env(self) -> Dict[str, str]: ...
@property
def posargs(self) -> List[str]: ...
@property
def virtualenv(self) -> nox.virtualenv.ProcessEnv: ...
@property
def python(self) -> Python: ...
@property
def bin_paths(self) -> Optional[List[str]]: ...
@property
def bin(self) -> Optional[str]: ...
def create_tmp(self) -> str: ...
@property
def interactive(self) -> bool: ...
def chdir(self, dir: str) -> None: ...
def cd(self, dir: str) -> None: ...
def run(
self, *args: str, env: Optional[Mapping[str, str]] = ..., **kwargs: Any
) -> Optional[Any]: ...
def run_always(
self, *args: str, env: Optional[Mapping[str, str]] = ..., **kwargs: Any
) -> Optional[Any]: ...
def conda_install(
self, *args: str, auto_offline: bool = ..., **kwargs: Any
) -> None: ...
def notify(self, target: Union[str, nox.sessions.SessionRunner]) -> None: ...
def log(self, *args: Any, **kwargs: Any) -> None: ...
def error(self, *args: Any) -> NoReturn: ...
def skip(self, *args: Any) -> NoReturn: ...
poetry: _PoetrySession

SessionFunction = Callable[..., None]
SessionDecorator = Callable[[SessionFunction], SessionFunction]

@overload
def session(__func: SessionFunction) -> SessionFunction: ...
@overload
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def tests(proxy: nox_poetry.Session) -> None:

[proxy] = calls

assert proxy._session is session
assert proxy._session is session # type: ignore[attr-defined]


def test_wrapper_parametrize(session: nox.Session) -> None:
Expand Down

0 comments on commit 809db93

Please sign in to comment.