Skip to content

2.5.0: pytest warnings #59

@kloczek

Description

@kloczek

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.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix>
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")

Here is pytest output:

Details
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-sphinx-sitemap-2.5.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-sphinx-sitemap-2.5.0-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.2.1, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/sphinx-sitemap-2.5.0
collected 4 items

tests/test_parallel_mode.py .                                            [ 25%]
tests/test_simple.py ...                                                 [100%]

=============================== warnings summary ===============================
tests/test_parallel_mode.py::test_parallel
tests/test_parallel_mode.py::test_parallel
  /usr/lib64/python3.8/importlib/__init__.py:127: RemovedInSphinx80Warning: The alias 'sphinx.util.SkipProgressMessage' is deprecated, use 'sphinx.util.display.SkipProgressMessage' instead. Check CHANGES for Sphinx API modifications.
    return _bootstrap._gcd_import(name[level:], package, level)

tests/test_parallel_mode.py::test_parallel
tests/test_parallel_mode.py::test_parallel
tests/test_parallel_mode.py::test_parallel
tests/test_parallel_mode.py::test_parallel
  /usr/lib64/python3.8/importlib/__init__.py:127: RemovedInSphinx80Warning: The alias 'sphinx.util.progress_message' is deprecated, use 'sphinx.util.display.progress_message' instead. Check CHANGES for Sphinx API modifications.
    return _bootstrap._gcd_import(name[level:], package, level)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================== 4 passed, 6 warnings in 1.47s =========================

Here is list of installed modules in build env

Details
Package                       Version
----------------------------- -----------------
alabaster                     0.7.12
appdirs                       1.4.4
attrs                         22.2.0
Babel                         2.11.0
build                         0.9.0
charset-normalizer            3.0.1
cssselect                     1.1.0
distro                        1.8.0
docutils                      0.19
exceptiongroup                1.0.0
extras                        1.0.0
fixtures                      4.0.0
gpg                           1.18.0-unknown
idna                          3.4
imagesize                     1.4.1
importlib-metadata            6.0.0
iniconfig                     2.0.0
Jinja2                        3.1.2
libcomps                      0.1.19
lxml                          4.9.2
MarkupSafe                    2.1.1
numpy                         1.24.1
olefile                       0.46
packaging                     21.3
pbr                           5.9.0
pep517                        0.13.0
Pillow                        9.4.0
pip                           22.3.1
pluggy                        1.0.0
Pygments                      2.14.0
PyGObject                     3.42.2
pyparsing                     3.0.9
pytest                        7.2.1
python-dateutil               2.8.2
pytz                          2022.4
requests                      2.28.2
rpm                           4.17.0
scour                         0.38.2
setuptools                    65.6.3
six                           1.16.0
snowballstemmer               2.2.0
Sphinx                        6.1.3
sphinx_contributors           0.2.7
sphinxcontrib-applehelp       1.0.2.dev20221204
sphinxcontrib-devhelp         1.0.2.dev20221204
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1.dev20230128
sphinxcontrib-qthelp          1.0.3.dev20230128
sphinxcontrib-serializinghtml 1.1.5
sphinxemoji                   0.2.0
testtools                     2.5.0
tomli                         2.0.1
urllib3                       1.26.12
wheel                         0.38.4
zipp                          3.11.0

I also have two small patches which I'm using during build my package with sphinx documentation as man page.
Beow patch alows build socumetation without have installed sphinx-sitemap module using straight source tree

--- a/docs/conf.py
+++ b/docs/conf.py
@@ -11,9 +11,13 @@
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
 #
+import os
+import sys
 import re
 import subprocess

+sys.path.insert(0, os.path.abspath(".."))
+
 # -- Project information -----------------------------------------------------

 project = "Sphinx Sitemap"

Sesond patch allows obtain module version not from git tag but from module version

--- a/docs/conf.py
+++ b/docs/conf.py
@@ -15,22 +15,18 @@
 import sys
 import re
 import subprocess
-
 sys.path.insert(0, os.path.abspath(".."))

+import sphinx_sitemap
+
 # -- Project information -----------------------------------------------------

 project = "Sphinx Sitemap"
 copyright = "Jared Dillard"
 author = "Jared Dillard"

-# check if the current commit is tagged as a release (vX.Y.Z)
-GIT_TAG_OUTPUT = subprocess.check_output(["git", "tag", "--points-at", "HEAD"])
-current_tag = GIT_TAG_OUTPUT.decode().strip()
-if re.match(r"^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$", current_tag):
-    version = current_tag
-else:
-    version = "latest"
+version = sphinx_sitemap.__version__
+
 # The full version, including alpha/beta/rc tags
 release = ""

Second on is usuefull on build module out of autogenerated fron git tag tar ball which has no .git metadata.
With abpve patches is possible to generate documentation by:

+ /usr/bin/sphinx-build -n -T -b man docs build/sphinx/man
Running Sphinx v6.1.3
making output directory... done
loading intersphinx inventory from https://www.sphinx-doc.org/en/master/objects.inv...
building [mo]: targets for 0 po files that are out of date
writing output...
building [man]: all manpages
updating environment: [new config] 7 added, 0 changed, 0 removed
reading sources... [ 14%] advanced-configuration
reading sources... [ 28%] changelog
reading sources... [ 42%] configuration-values
reading sources... [ 57%] contributing
reading sources... [ 71%] getting-started
reading sources... [ 85%] index
reading sources... [100%] search-optimization

looking for now-outdated files... none found
pickling environment... done
checking consistency... done
writing... python-sphinx-sitemap.3 { getting-started advanced-configuration search-optimization configuration-values contributing changelog } done
sphinx-sitemap: No pages generated for sitemap.xml
build succeeded.

Feel free to commit those patch or let me know if you want them as PRs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions