-
-
Notifications
You must be signed in to change notification settings - Fork 62
/
noxfile.py
52 lines (42 loc) · 1.71 KB
/
noxfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import inspect
import nox
nox.needs_version = ">=2024.4.15"
nox.options.default_venv_backend = "uv|virtualenv"
@nox.session
@nox.parametrize("editable", [True, False])
def rename(session: nox.Session, editable: bool) -> None:
session.install("-e." if editable else ".")
# Ensure warning is not visible by default
assert "import python_multipart" not in session.run("python", "-c", "import multipart", silent=True)
assert "import python_multipart" in session.run("python", "-Wdefault", "-c", "import multipart", silent=True)
assert "import python_multipart" in session.run(
"python", "-Wdefault", "-c", "import multipart.exceptions", silent=True
)
assert "import python_multipart" in session.run(
"python", "-Wdefault", "-c", "from multipart import exceptions", silent=True
)
assert "import python_multipart" in session.run(
"python", "-Wdefault", "-c", "from multipart.exceptions import FormParserError", silent=True
)
session.install("multipart")
assert "import python_multipart" not in session.run(
"python", "-Wdefault", "-c", "import multipart; multipart.parse_form_data", silent=True
)
assert "import python_multipart" not in session.run(
"python", "-Wdefault", "-c", "import python_multipart; python_multipart.parse_form", silent=True
)
@nox.session
def rename_inline(session: nox.Session) -> None:
session.install("pip")
res = session.run(
"python",
"-Wdefault",
"-c",
inspect.cleandoc("""
import subprocess
subprocess.run(["pip", "install", "."])
import multipart
"""),
silent=True,
)
assert "Please use `import python_multipart` instead." in res