Skip to content

Commit

Permalink
fix: reduce visibility of warning for next release (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii authored Oct 27, 2024
1 parent 6e0a3d8 commit 5578583
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
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

0 comments on commit 5578583

Please sign in to comment.