Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reduce visibility of warning for next release #174

Merged
merged 1 commit into from
Oct 27, 2024
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
2 changes: 1 addition & 1 deletion multipart/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
spec.loader.exec_module(module)
break
else:
warnings.warn("Please use `import python_multipart` instead.", FutureWarning, stacklevel=2)
warnings.warn("Please use `import python_multipart` instead.", PendingDeprecationWarning, stacklevel=2)
from python_multipart import *
23 changes: 14 additions & 9 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@


@nox.session
def rename(session: nox.Session) -> None:
session.install(".")
assert "import python_multipart" in session.run("python", "-c", "import multipart", silent=True)
assert "import python_multipart" in session.run("python", "-c", "import multipart.exceptions", silent=True)
assert "import python_multipart" in session.run("python", "-c", "from multipart import exceptions", silent=True)
@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", "-c", "from multipart.exceptions import FormParserError", silent=True
"python", "-Wdefault", "-c", "from multipart.exceptions import FormParserError", silent=True
)

session.install("multipart")
assert "import python_multipart" not in session.run(
"python", "-c", "import multipart; multipart.parse_form_data", silent=True
"python", "-Wdefault", "-c", "import multipart; multipart.parse_form_data", silent=True
)
assert "import python_multipart" not in session.run(
"python", "-c", "import python_multipart; python_multipart.parse_form", silent=True
"python", "-Wdefault", "-c", "import python_multipart; python_multipart.parse_form", silent=True
)


Expand All @@ -30,6 +34,7 @@ def rename_inline(session: nox.Session) -> None:
session.install("pip")
res = session.run(
"python",
"-Wdefault",
"-c",
inspect.cleandoc("""
import subprocess
Expand All @@ -40,4 +45,4 @@ def rename_inline(session: nox.Session) -> None:
"""),
silent=True,
)
assert "FutureWarning: Please use `import python_multipart` instead." in res
assert "Please use `import python_multipart` instead." in res