diff --git a/multipart/__init__.py b/multipart/__init__.py index 212af4e..f28c0c3 100644 --- a/multipart/__init__.py +++ b/multipart/__init__.py @@ -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 * diff --git a/noxfile.py b/noxfile.py index 1df0fd7..20de33e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -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 ) @@ -30,6 +34,7 @@ def rename_inline(session: nox.Session) -> None: session.install("pip") res = session.run( "python", + "-Wdefault", "-c", inspect.cleandoc(""" import subprocess @@ -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