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
5 changes: 4 additions & 1 deletion tests/test_find_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ def check_find_names(
if not confirm:
return

exec_locals: object
exec_locals = {}
actually_undefined = undefined - set(dir(__import__("builtins")))
if actually_undefined:
# If something is actually undefined, we should raise a NameError when we execute
# (if we hit another exception first, we fix the test!)
with pytest.raises(NameError) as e:
exec(code, exec_locals)
undefined_var = re.search(r"(name|variable) '(\w+)'", e.value.args[0]).group(2)
m = re.search(r"(name|variable) '(\w+)'", e.value.args[0])
assert m is not None
undefined_var = m.group(2)
assert undefined_var in actually_undefined
else:
try:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pyp.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def delete_config_env_var(monkeypatch):
monkeypatch.delenv("PYP_CONFIG_PATH", raising=False)


def run_cmd(cmd: str, input: Optional[str] = None, check: bool = True) -> str:
def run_cmd(cmd: str, input: Union[str, bytes, None] = None, check: bool = True) -> str:
if isinstance(input, str):
input = input.encode("utf-8")
proc = subprocess.run(
Expand Down
5 changes: 4 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ commands =
isort --diff --check --quiet .

[testenv:mypy]
deps = mypy>=1.13
deps =
mypy>=1.13
pytest
commands =
mypy --strict -m pyp --python-version 3.8
mypy --strict -m pyp --python-version 3.13
mypy . --python-version 3.13

[coverage:report]
exclude_lines =
Expand Down
Loading