bottlepy / bottle

bottle.py is a fast and simple micro-framework for python web-applications.
http://bottlepy.org/
MIT License
8.39k stars 1.47k forks source link

0.12.25: pytest deprecation warnings #1421

Closed kloczek closed 3 weeks ago

kloczek commented 1 year ago

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

Here is pytest output:

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-bottle-0.12.25-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-bottle-0.12.25-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' ==================================================================================== test session starts ==================================================================================== platform linux -- Python 3.8.16, pytest-7.3.1, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25 collected 325 items test/test_auth.py . [ 0%] test/test_config.py ..... [ 1%] test/test_configdict.py ....... [ 4%] test/test_contextlocals.py .. [ 4%] test/test_environ.py ..................................................................... [ 25%] test/test_fileupload.py ......... [ 28%] test/test_formsdict.py .... [ 29%] test/test_importhook.py ..... [ 31%] test/test_jinja2.py .......... [ 34%] test/test_mdict.py .... [ 35%] test/test_mount.py ......... [ 38%] test/test_outputfilter.py ........................ [ 45%] test/test_plugins.py ................... [ 51%] test/test_resources.py ........ [ 54%] test/test_route.py . [ 54%] test/test_router.py ................................ [ 64%] test/test_securecookies.py .... [ 65%] test/test_sendfile.py ........... [ 68%] test/test_server.py ............. [ 72%] test/test_stpl.py ...................................................... [ 89%] test/test_wsgi.py .................................. [100%] ===================================================================================== warnings summary ====================================================================================== test/test_server.py:53 /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_server.py:53: SyntaxWarning: "is" with a literal. Did you mean "=="? if rv is 128: # Import error test/test_server.py:57 /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_server.py:57: SyntaxWarning: "is" with a literal. Did you mean "=="? if rv is 3: # Port in use test/test_configdict.py::TestConfigDict::test_attr_access /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_configdict.py:30: DeprecationWarning: Attribute assignment is deprecated. c.test = 5 test/test_configdict.py::TestConfigDict::test_attr_access /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_configdict.py:31: DeprecationWarning: Attribute access is deprecated. self.assertEqual(5, c.test) test/test_configdict.py::TestConfigDict::test_attr_access /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_configdict.py:34: DeprecationWarning: Attribute access is deprecated. self.assertEqual(6, c.test) test/test_configdict.py::TestConfigDict::test_attr_access /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_configdict.py:38: DeprecationWarning: Attribute access is deprecated. self.assertEqual(None, c.test) test/test_configdict.py::TestConfigDict::test_call /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_configdict.py:61: DeprecationWarning: Calling ConfDict is deprecated. Use the update() method. self.assertEqual(c, c(a=1)) test/test_configdict.py::TestConfigDict::test_call /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_configdict.py:63: DeprecationWarning: Attribute access is deprecated. self.assertEqual(1, c.a) test/test_configdict.py::TestConfigDict::test_isadict /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_configdict.py:12: DeprecationWarning: Constructor does no longer accept parameters. d, m = dict(a=5), ConfigDict(a=5) test/test_configdict.py::TestConfigDict::test_issue588 /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_configdict.py:70: DeprecationWarning: Accessing namespaces as dicts is discouraged. Only use flat item access: cfg["names"]["pace"]["key"] -> cfg["name.space.key"] self.assertEqual('c', c['a']['b']) test/test_configdict.py::TestConfigDict::test_issue588 /usr/lib64/python3.8/_collections_abc.py:744: DeprecationWarning: Accessing namespaces as dicts is discouraged. Only use flat item access: cfg["names"]["pace"]["key"] -> cfg["name.space.key"] yield (key, self._mapping[key]) test/test_configdict.py::TestConfigDict::test_namespaces test/test_configdict.py::TestConfigDict::test_namespaces /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_configdict.py:43: DeprecationWarning: Attribute access is deprecated. self.assertEqual(ConfigDict.Namespace, c.Name.Space.__class__) test/test_configdict.py::TestConfigDict::test_namespaces test/test_configdict.py::TestConfigDict::test_namespaces test/test_configdict.py::TestConfigDict::test_namespaces test/test_configdict.py::TestConfigDict::test_namespaces test/test_configdict.py::TestConfigDict::test_namespaces /usr/lib64/python3.8/_collections_abc.py:660: DeprecationWarning: Accessing namespaces as dicts is discouraged. Only use flat item access: cfg["names"]["pace"]["key"] -> cfg["name.space.key"] return self[key] test/test_configdict.py::TestConfigDict::test_namespaces test/test_configdict.py::TestConfigDict::test_namespaces /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_configdict.py:44: DeprecationWarning: Attribute access is deprecated. c.Name.Space.value = 5 test/test_configdict.py::TestConfigDict::test_namespaces /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_configdict.py:44: DeprecationWarning: Attribute assignment is deprecated. c.Name.Space.value = 5 test/test_configdict.py::TestConfigDict::test_namespaces test/test_configdict.py::TestConfigDict::test_namespaces test/test_configdict.py::TestConfigDict::test_namespaces /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_configdict.py:45: DeprecationWarning: Attribute access is deprecated. self.assertEqual(5, c.Name.Space.value) test/test_configdict.py::TestConfigDict::test_namespaces test/test_configdict.py::TestConfigDict::test_namespaces /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_configdict.py:46: DeprecationWarning: Attribute access is deprecated. self.assertTrue('value' in c.Name.Space) test/test_configdict.py::TestConfigDict::test_namespaces /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_configdict.py:47: DeprecationWarning: Attribute access is deprecated. self.assertTrue('Space' in c.Name) test/test_configdict.py::TestConfigDict::test_namespaces /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_configdict.py:51: DeprecationWarning: Attribute assignment is deprecated. self.assertRaises(AttributeError, lambda: setattr(c, 'Name', 5)) test/test_configdict.py::TestConfigDict::test_namespaces /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_configdict.py:53: DeprecationWarning: Attribute assignment is deprecated. self.assertRaises(AttributeError, lambda: setattr(c, 'keys', 5)) test/test_configdict.py::TestConfigDict::test_namespaces /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/test/test_configdict.py:56: DeprecationWarning: Attribute access is deprecated. self.assertEqual(5, c.Name) test/test_jinja2.py::TestJinja2Template::test_file test/test_jinja2.py::TestJinja2Template::test_notfound test/test_stpl.py::TestSimpleTemplate::test_file test/test_stpl.py::TestSimpleTemplate::test_notfound /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/bottle.py:3268: DeprecationWarning: The template lookup path list should not be empty. self.filename = self.search(self.name, self.lookup) test/test_jinja2.py::TestJinja2Template::test_file test/test_stpl.py::TestSimpleTemplate::test_file /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/bottle.py:3268: DeprecationWarning: Absolute template path names are deprecated. self.filename = self.search(self.name, self.lookup) test/test_jinja2.py::TestJinja2Template::test_file /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/bottle.py:3383: DeprecationWarning: The template lookup path list should not be empty. fname = self.search(name, self.lookup) test/test_jinja2.py::TestJinja2Template::test_file test/test_jinja2.py::TestJinja2Template::test_inherit test/test_jinja2.py::TestJinja2Template::test_name /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/bottle.py:3383: DeprecationWarning: Absolute template path names are deprecated. fname = self.search(name, self.lookup) test/test_plugins.py: 15 warnings /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/bottle.py:539: DeprecationWarning: Switch to Plugin API v2 and access the Route object directly. context = self if api > 1 else self._context test/test_router.py::TestRouter::testFloatFilter test/test_router.py::TestRouterInCGIMode::testFloatFilter /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/bottle.py:392: RuntimeWarning: Route > overwrites a previously defined route warnings.warn(msg % (method, rule), RuntimeWarning) test/test_router.py::TestRouter::testParentheses test/test_router.py::TestRouterInCGIMode::testParentheses /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/bottle.py:392: RuntimeWarning: Route overwrites a previously defined route warnings.warn(msg % (method, rule), RuntimeWarning) test/test_stpl.py::TestSimpleTemplate::test_coding_stress test/test_stpl.py::TestSimpleTemplate::test_detect_pep263 test/test_stpl.py::TestSimpleTemplate::test_detect_pep263 /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/bottle.py:3622: DeprecationWarning: PEP263 encoding strings in templates are deprecated. line, comment = self.fix_backward_compatibility(line, comment) test/test_stpl.py::TestSimpleTemplate::test_detect_pep263 /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/bottle.py:201: DeprecationWarning: Template encodings other than utf8 are no longer supported. value = obj.__dict__[self.func.__name__] = self.func(obj) test/test_stpl.py::TestSimpleTemplate::test_escaped_codelines test/test_stpl.py::TestSimpleTemplate::test_escaped_codelines /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/bottle.py:3416: DeprecationWarning: Escape code lines with a backslash. code = parser.translate() test/test_stpl.py: 7 warnings test/test_wsgi.py: 8 warnings /home/tkloczko/rpmbuild/BUILD/bottle-0.12.25/bottle.py:3622: DeprecationWarning: The include and rebase keywords are functions now. line, comment = self.fix_backward_compatibility(line, comment) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ============================================================================= 325 passed, 80 warnings in 3.11s ============================================================================== ```

Here is list of installed modules in build env

```console Package Version ----------------------------- ------- alabaster 0.7.13 asttokens 2.2.1 Babel 2.12.1 backcall 0.2.0 build 0.10.0 charset-normalizer 3.1.0 decorator 5.1.1 distro 1.8.0 docutils 0.19 exceptiongroup 1.1.1 executing 1.2.0 gpg 1.20.0 idna 3.4 imagesize 1.4.1 importlib-metadata 6.6.0 iniconfig 2.0.0 installer 0.7.0 ipython 8.12.0 jedi 0.18.2 Jinja2 3.1.2 libcomps 0.1.19 MarkupSafe 2.1.2 matplotlib-inline 0.1.6 packaging 23.1 parso 0.8.3 pexpect 4.8.0 pickleshare 0.7.5 pluggy 1.0.0 prompt-toolkit 3.0.38 ptyprocess 0.7.0 pure-eval 0.2.2 Pygments 2.15.1 pyproject_hooks 1.0.0 pytest 7.3.1 python-dateutil 2.8.2 pytz 2023.2 requests 2.30.0 setuptools 67.7.2 six 1.16.0 snowballstemmer 2.2.0 Sphinx 6.2.1 sphinxcontrib-applehelp 1.0.4 sphinxcontrib-devhelp 1.0.2 sphinxcontrib-htmlhelp 2.0.0 sphinxcontrib-jsmath 1.0.1 sphinxcontrib-qthelp 1.0.3 sphinxcontrib-serializinghtml 1.1.5 stack-data 0.6.2 tomli 2.0.1 traitlets 5.9.0 typing_extensions 4.5.0 urllib3 1.26.15 wcwidth 0.2.6 wheel 0.40.0 zipp 3.15.0 ```
BubaVV commented 1 year ago

Easier reproduce is possible - just run pytest -ra in environment with Python 3.8 and pytest 7.3.1

defnull commented 3 weeks ago

Most warnings should be gone by now in 0.13-dev (released soon)