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

1.8.2: pytest warnings #655

Open
kloczek opened this issue Sep 4, 2023 · 0 comments
Open

1.8.2: pytest warnings #655

kloczek opened this issue Sep 4, 2023 · 0 comments

Comments

@kloczek
Copy link

kloczek commented Sep 4, 2023

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> using 'installer` module
  • 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:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-plumbum-1.8.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-plumbum-1.8.2-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.18, pytest-7.4.1, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/plumbum-1.8.2
configfile: pyproject.toml
plugins: timeout-2.1.0, mock-3.11.1
timeout: 300.0s
timeout method: signal
timeout func_only: False
collected 275 items

tests/test_3_cli.py ..                                                                                                                                                                [  0%]
tests/test_cli.py ................                                                                                                                                                    [  6%]
tests/test_clicolor.py ......                                                                                                                                                         [  8%]
tests/test_color.py .........                                                                                                                                                         [ 12%]
tests/test_config.py .......                                                                                                                                                          [ 14%]
tests/test_env.py ......                                                                                                                                                              [ 16%]
tests/test_factories.py ....................                                                                                                                                          [ 24%]
tests/test_local.py ...........................................................................ss........................                                                             [ 60%]
tests/test_nohup.py ....                                                                                                                                                              [ 62%]
tests/test_putty.py ...                                                                                                                                                               [ 63%]
tests/test_remote.py sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss                                                                                        [ 89%]
tests/test_sudo.py s                                                                                                                                                                  [ 90%]
tests/test_terminal.py ..............                                                                                                                                                 [ 95%]
tests/test_typed_env.py .                                                                                                                                                             [ 95%]
tests/test_utils.py s                                                                                                                                                                 [ 96%]
tests/test_validate.py ........                                                                                                                                                       [ 98%]
tests/test_visual_color.py ...                                                                                                                                                        [100%]

===================================================================================== warnings summary ======================================================================================
tests/test_local.py::TestLocalMachine::test_redirection
  /home/tkloczko/rpmbuild/BUILDROOT/python-plumbum-1.8.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/plumbum/commands/base.py:396: ResourceWarning: unclosed file <_io.BufferedRandom name=13>
    srcproc = self.srccmd.popen(args, **src_kwargs)
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_timeout
  /home/tkloczko/rpmbuild/BUILDROOT/python-plumbum-1.8.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/plumbum/path/base.py:345: ResourceWarning: unclosed file <_io.FileIO name=18 mode='rb' closefd=True>
    return reduce(operator.or_, [flags[m] for m in mode.lower()], 0)
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_iter_lines_buffer_size
  /usr/lib64/python3.8/subprocess.py:946: ResourceWarning: subprocess 5730 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_iter_lines_error
  /usr/lib/python3.8/site-packages/_pytest/skipping.py:180: ResourceWarning: unclosed file <_io.FileIO name=18 mode='wb' closefd=True>
    for condition in conditions:
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_iter_lines_error
  /usr/lib/python3.8/site-packages/_pytest/skipping.py:180: ResourceWarning: unclosed file <_io.FileIO name=19 mode='rb' closefd=True>
    for condition in conditions:
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_iter_lines_error
  /usr/lib/python3.8/site-packages/_pytest/skipping.py:180: ResourceWarning: unclosed file <_io.FileIO name=21 mode='rb' closefd=True>
    for condition in conditions:
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_iter_lines_line_timeout
  /usr/lib64/python3.8/subprocess.py:946: ResourceWarning: subprocess 5742 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_tee_modifier
  /home/tkloczko/rpmbuild/BUILDROOT/python-plumbum-1.8.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/plumbum/path/base.py:345: ResourceWarning: unclosed file <_io.FileIO name=19 mode='wb' closefd=True>
    return reduce(operator.or_, [flags[m] for m in mode.lower()], 0)
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_tee_modifier
  /home/tkloczko/rpmbuild/BUILDROOT/python-plumbum-1.8.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/plumbum/path/base.py:345: ResourceWarning: unclosed file <_io.FileIO name=21 mode='rb' closefd=True>
    return reduce(operator.or_, [flags[m] for m in mode.lower()], 0)
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_tee_modifier
  /home/tkloczko/rpmbuild/BUILDROOT/python-plumbum-1.8.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/plumbum/path/base.py:345: ResourceWarning: unclosed file <_io.FileIO name=26 mode='rb' closefd=True>
    return reduce(operator.or_, [flags[m] for m in mode.lower()], 0)
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_tee_modifier
tests/test_local.py::TestLocalMachine::test_run_tf
  /home/tkloczko/rpmbuild/BUILDROOT/python-plumbum-1.8.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/plumbum/path/base.py:345: ResourceWarning: unclosed file <_io.FileIO name=34 mode='rb' closefd=True>
    return reduce(operator.or_, [flags[m] for m in mode.lower()], 0)
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_redirection_stdin_modifiers_fg[modifier0-None]
tests/test_local.py::TestLocalMachine::test_redirection_stdin_modifiers_fg[modifier1-True]
tests/test_local.py::TestLocalMachine::test_redirection_stdin_modifiers_fg[modifier2-0]
tests/test_local.py::TestLocalMachine::test_redirection_stdin_modifiers_fg[modifier3-expected3]
  /home/tkloczko/rpmbuild/BUILDROOT/python-plumbum-1.8.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/plumbum/commands/base.py:207: ResourceWarning: unclosed file <_io.BufferedRandom name=31>
    p = self.popen(args, **kwargs)
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_logger_pipe
  /home/tkloczko/rpmbuild/BUILDROOT/python-plumbum-1.8.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/plumbum/commands/modifiers.py:493: ResourceWarning: unclosed file <_io.BufferedWriter name=16>
    return cmd & self.pipe(
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_logger_pipe
  /home/tkloczko/rpmbuild/BUILDROOT/python-plumbum-1.8.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/plumbum/commands/modifiers.py:493: ResourceWarning: unclosed file <_io.BufferedWriter name=19>
    return cmd & self.pipe(
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_logger_pipe
  /home/tkloczko/rpmbuild/BUILD/plumbum-1.8.2/tests/test_local.py:682: ResourceWarning: unclosed file <_io.BufferedWriter name=24>
    ret = bash["-ce", "echo ccc 1>&2; false"] & logger.pipe(
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_logger_pipe_line_timeout
  /usr/lib64/python3.8/subprocess.py:946: ResourceWarning: subprocess 5770 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_session
  /usr/lib64/python3.8/subprocess.py:946: ResourceWarning: subprocess 5779 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_local_daemon
  /usr/lib/python3.8/site-packages/_pytest/logging.py:376: ResourceWarning: unclosed file <_io.FileIO name=18 mode='rb' closefd=True>
    self.stream = StringIO()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_local_daemon
  /usr/lib/python3.8/site-packages/_pytest/logging.py:376: ResourceWarning: unclosed file <_io.FileIO name=20 mode='rb' closefd=True>
    self.stream = StringIO()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_local_daemon
  /usr/lib/python3.8/site-packages/_pytest/logging.py:376: ResourceWarning: unclosed file <_io.FileIO name=21 mode='rb' closefd=True>
    self.stream = StringIO()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_local_daemon
  /usr/lib/python3.8/site-packages/_pytest/logging.py:376: ResourceWarning: unclosed file <_io.FileIO name=26 mode='rb' closefd=True>
    self.stream = StringIO()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_local_daemon
  /usr/lib/python3.8/site-packages/_pytest/logging.py:376: ResourceWarning: unclosed file <_io.FileIO name=29 mode='rb' closefd=True>
    self.stream = StringIO()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_local_daemon
  /usr/lib/python3.8/site-packages/_pytest/logging.py:376: ResourceWarning: unclosed file <_io.FileIO name=32 mode='rb' closefd=True>
    self.stream = StringIO()
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_run_tf
  /home/tkloczko/rpmbuild/BUILDROOT/python-plumbum-1.8.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/plumbum/path/base.py:345: ResourceWarning: unclosed file <_io.FileIO name=36 mode='rb' closefd=True>
    return reduce(operator.or_, [flags[m] for m in mode.lower()], 0)
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_run_tf
  /home/tkloczko/rpmbuild/BUILDROOT/python-plumbum-1.8.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/plumbum/path/base.py:345: ResourceWarning: unclosed file <_io.FileIO name=37 mode='rb' closefd=True>
    return reduce(operator.or_, [flags[m] for m in mode.lower()], 0)
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_local.py::TestLocalMachine::test_run_tf
  /home/tkloczko/rpmbuild/BUILDROOT/python-plumbum-1.8.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/plumbum/path/base.py:345: ResourceWarning: unclosed file <_io.FileIO name=38 mode='rb' closefd=True>
    return reduce(operator.or_, [flags[m] for m in mode.lower()], 0)
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_nohup.py::TestNohupLocal::test_redir
  /usr/lib64/python3.8/subprocess.py:946: ResourceWarning: subprocess 5898 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_nohup.py::TestNohupLocal::test_redir
  /usr/lib64/python3.8/subprocess.py:946: ResourceWarning: subprocess 5904 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_nohup.py::TestNohupLocal::test_redir
  /usr/lib64/python3.8/subprocess.py:946: ResourceWarning: subprocess 5906 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_putty.py::TestPuttyMachine::test_putty_command[default]
  /usr/lib64/python3.8/subprocess.py:946: ResourceWarning: subprocess 5910 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_putty.py::TestPuttyMachine::test_putty_command[default]
  /usr/lib64/python3.8/subprocess.py:946: ResourceWarning: subprocess 5913 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

tests/test_putty.py::TestPuttyMachine::test_putty_command[322]
  /usr/lib64/python3.8/subprocess.py:946: ResourceWarning: subprocess 5908 is still running
    _warn("subprocess %s is still running" % self.pid,
  Enable tracemalloc to get traceback where the object was allocated.
  See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================== short test summary info ==================================================================================
SKIPPED [1] tests/test_local.py:821: Not a TTY
SKIPPED [1] tests/test_local.py:832: Not a TTY
SKIPPED [1] tests/test_remote.py:57: Skipping; marked with disabled optional tests (skipif, ssh)
SKIPPED [1] tests/test_remote.py: Skipping; marked with disabled optional tests (ssh)
SKIPPED [1] tests/test_remote.py:76: Skipping; marked with disabled optional tests (xfail, ssh)
SKIPPED [40] tests/test_remote.py: Skipping; marked with disabled optional tests (skipif, ssh)
SKIPPED [1] tests/test_remote.py:149: Skipping; marked with disabled optional tests (skipif, ssh)
SKIPPED [1] tests/test_remote.py:183: Skipping; marked with disabled optional tests (xfail, skipif, ssh)
SKIPPED [2] tests/test_remote.py:344: Skipping; marked with disabled optional tests (usefixtures, skipif, ssh)
SKIPPED [2] tests/test_remote.py:362: Skipping; marked with disabled optional tests (xfail, skipif, ssh)
SKIPPED [18] tests/test_remote.py:382: Skipping; marked with disabled optional tests (ssh, xfail, skipif, parametrize)
SKIPPED [2] tests/test_remote.py:467: Skipping; marked with disabled optional tests (ssh, skipif, parametrize)
SKIPPED [2] tests/test_remote.py:498: Skipping; marked with disabled optional tests (ssh, skipif, parametrize)
SKIPPED [1] tests/test_remote.py:580: Skipping; marked with disabled optional tests (skipif, ssh)
SKIPPED [1] tests/test_remote.py:636: Skipping; marked with disabled optional tests (xfail, skipif, ssh)
SKIPPED [1] tests/test_sudo.py:13: Skipping; marked with disabled optional tests (sudo, skipif)
SKIPPED [1] tests/test_utils.py:8: Skipping; marked with disabled optional tests (skipif, ssh)
======================================================================= 198 passed, 77 skipped, 36 warnings in 25.09s =======================================================================

Here is list of installed modules in build env

Package                       Version
----------------------------- --------
alabaster                     0.7.13
Babel                         2.12.1
build                         0.10.0
charset-normalizer            3.2.0
distro                        1.8.0
docutils                      0.20.1
editables                     0.5
exceptiongroup                1.1.3
gpg                           1.21.0
hatch-vcs                     0.3.0
hatchling                     1.18.0
idna                          3.4
imagesize                     1.4.1
importlib-metadata            6.8.0
iniconfig                     2.0.0
installer                     0.7.0
Jinja2                        3.1.2
libcomps                      0.1.19
MarkupSafe                    2.1.3
packaging                     23.1
pathspec                      0.11.2
pkg                           0.0.0
pluggy                        1.3.0
psutil                        5.9.5
Pygments                      2.16.0
pyproject_hooks               1.0.0
pytest                        7.4.1
pytest-mock                   3.11.1
pytest-timeout                2.1.0
python-dateutil               2.8.2
pytz                          2023.3
requests                      2.31.0
setuptools                    68.0.0
setuptools-scm                7.1.0
six                           1.16.0
snowballstemmer               2.2.0
Sphinx                        7.0.1
sphinxcontrib-applehelp       1.0.4
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.3
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.9
tomli                         2.0.1
trove-classifiers             2023.8.9
typing_extensions             4.7.1
urllib3                       1.26.16
wheel                         0.41.1
zipp                          3.16.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant