python/cpython

test_sysconfig.TestSysConfig.test_sysconfigdata_json fails: it expects 'userbase' to be '/root/.local'

Opened this issue · 5 comments

Bug report

Bug description:

As in the title. We hit this in Fedora, can it be caused by the mismatch of users (one which generated the file, the other which runs tests?)

FAIL: test_sysconfigdata_json (test.test_sysconfig.TestSysConfig.test_sysconfigdata_json)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.14/test/test_sysconfig.py", line 671, in test_sysconfigdata_json
    self.assertEqual(system_config_vars, json_config_vars)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<snip>
-  'userbase': '/root/.local'}
?                 ---

+  'userbase': '/builddir/.local'}
?                +++++++

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs

FFY00 commented

@befeleme thanks for the report, please provide reproduction instructions, otherwise I can't debug the issue.

For now I only have a Fedora-specific example. I'm not sure whether this is something related to our environment only or a general issue. It appeared on our CI which installs the built Python rpm package and runs the test suite in a fresh environment. I don't control the environment, but you can see the results here: https://artifacts.dev.testing-farm.io/a7c444e9-2e53-4a09-8a5a-33666297c776/#artifacts-git-refs-pull-19-headndwq3vz8/tests/tests.yml

To reproduce with a Fedora Rawhide container:
python3.14.0a3 as an RPM can be found here: https://koji.fedoraproject.org/koji/taskinfo?taskID=126962646
python3.14-libs contains the /usr/lib64/python3.14/_sysconfig_vars__linux_x86_64-linux-gnu.json file, which was generated during the build, hence the 'userbase' is set to '/builddir/.local'.
For convenience, download all the python3.14-*.x86_64.rpm to a fresh Fedora Rawhide container.
Install with: dnf install python3.14*
Run python3.14 -m test test_sysconfig - the same AssertionError appears.

I'm trying to find a better reproducer that wouldn't require rpm magic.

FFY00 commented

You are running the tests after installation, right? Since userbase is generated dynamically, it would change after installing. I opened GH-128070 to make the test ignore userbase. I also opened GH-128072 to explore a way to mitigate this kind of issues.

Feel free to ignore this test for now, or backport the fix. The failure is a false positive, it does not expose a real bug.

You are running the tests after installation, right?

Yes. Thank you for looking into this.