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

tox4: sub process "pip list" by "subprocess.Popen, communicate()" returns empty in Fedora 36 container in GitHub Actions #2737

Closed
junaruga opened this issue Dec 16, 2022 · 3 comments
Labels
bug:minor does not affect many people or has no big impact help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.

Comments

@junaruga
Copy link

junaruga commented Dec 16, 2022

Issue

Describe what's the expected behaviour and what you're observing.

The tox 4.0.11 is executed in Fedora 36 and 35 Docker containers on GitHub Actions (host OS: Ubuntu 22.0.4 LTS).

The tox executes the pip list as a sub process in the following code.

https://github.com/junaruga/rpm-py-installer/blob/2e4e7fe87c17639d06386653125d942228fb306f/install.py#L1546-L1547

        cmd = '{0} list --format json'.format(self._get_pip_cmd())
        json_str = Cmd.sh_e_out(cmd).split('\n')[0]

https://github.com/junaruga/rpm-py-installer/blob/2e4e7fe87c17639d06386653125d942228fb306f/install.py#L1979-L1985

            proc = subprocess.Popen(cmd, **cmd_kwargs)
            stdout, stderr = proc.communicate()
            returncode = proc.returncode
            message_format = (
                'CMD Return Code: [{0}], Stdout: [{1}], Stderr: [{2}]'
            )
            Log.debug(message_format.format(returncode, stdout, stderr))
[DEBUG] CMD: /work/.tox/py310/bin/python -m pip list
[DEBUG] CMD Return Code: [0], Stdout: [None], Stderr: [b'']
[DEBUG] CMD: pip list
[DEBUG] CMD Return Code: [0], Stdout: [None], Stderr: [b'']

Interestingly when running the used Fedora 36 containers on local environment (Fedora 37), the pip list returned the stdout correctly. And this issue doesn't happen on the latest tox version 3 (= 3.27.1).

Environment

Provide at least:

  • OS: Fedora Linux 36 and 35 Docker containers on GitHub Actions (Ubuntu 22.0.4 LTS).
  • pip list of the host Python where tox is installed:
 + pip list
Package                  Version
------------------------ ----------
attrs                    22.1.0
backports.unittest-mock  1.5
cachetools               5.2.0
chardet                  5.1.0
colorama                 0.4.6
dbus-python              1.2.18
distlib                  0.3.6
distro                   1.6.0
exceptiongroup           1.0.4
filelock                 3.8.2
gpg                      1.17.0
iniconfig                1.1.1
libcomps                 0.1.18
packaging                22.0
pip                      22.3.1
platformdirs             2.6.0
pluggy                   1.0.0
pyproject_api            1.2.1
pytest                   7.2.0
pytest-helpers-namespace 2021.12.29
python-dateutil          2.8.1
rpm                      4.17.1
setuptools               65.6.3
six                      1.16.0
tomli                    2.0.1
tox                      4.0.11
virtualenv               20.17.1

Output of running tox

Provide the output of tox -rvv:

I am sorry, here is the used tox.ini. As the result is quite long. If you need it, I am happy to capture and share the log text.
https://github.com/junaruga/rpm-py-installer/blob/master/tox.ini#L2

Minimal example

If possible, provide a minimal reproducer for the issue:

I am sorry. I don't find a minimal reproducer.

Reproducing steps

I can tell how to reproduce this issue. Sorry for inconvenience.

  1. Fork the repository: https://github.com/junaruga/rpm-py-installer .
  2. Add an empty commit on the master branch such as git commit --allow-empty.
  3. Push the branch to your forked repository.
  4. This GitHub Actions are triggered by a push to any branches on the forked repository.
  5. See "test-and-buiild (fedora_36 ...)" case in the GitHub Actions.
  6. Click "Run the testes" - Search the line by "pip list". The actual log is like this.

If you want to test with tox 3 to compare the result, you can do like this.

diff --git a/tox-requirements.txt b/tox-requirements.txt
index 46ce3b9..e46c5b1 100644
--- a/tox-requirements.txt
+++ b/tox-requirements.txt
@@ -1,4 +1,4 @@
 pip
 setuptools
 virtualenv
-tox
+tox<4
@gaborbernat gaborbernat added bug:minor does not affect many people or has no big impact help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted. labels Dec 16, 2022
@gaborbernat gaborbernat added this to the 4.1 milestone Dec 16, 2022
@gaborbernat
Copy link
Member

PR welcome, seems super edge case though 🤔

@junaruga
Copy link
Author

If I could know what the cause is, I would be happy to send PR.

@gaborbernat
Copy link
Member

Unable to replicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:minor does not affect many people or has no big impact help:wanted Issues that have been acknowledged, a solution determined and a PR might likely be accepted.
Projects
None yet
Development

No branches or pull requests

2 participants