Skip to content

site.{usercustomize,sitecustomize} hooks are never tested #108747

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

Closed
sobolevn opened this issue Sep 1, 2023 · 0 comments
Closed

site.{usercustomize,sitecustomize} hooks are never tested #108747

sobolevn opened this issue Sep 1, 2023 · 0 comments
Labels
stdlib Python modules in the Lib dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

sobolevn commented Sep 1, 2023

Bug report

They are documented:

The Customization Modules
-------------------------

Python provides two hooks to let you customize it: :mod:`sitecustomize` and
:mod:`usercustomize`.  To see how it works, you need first to find the location
of your user site-packages directory.  Start Python and run this code::

   >>> import site
   >>> site.getusersitepackages()
   '/home/user/.local/lib/python3.5/site-packages'

Now you can create a file named :file:`usercustomize.py` in that directory and
put anything you want in it.  It will affect every invocation of Python, unless
it is started with the :option:`-s` option to disable the automatic import.

:mod:`sitecustomize` works in the same way, but is typically created by an
administrator of the computer in the global site-packages directory, and is
imported before :mod:`usercustomize`.  See the documentation of the :mod:`site`
module for more details.

But, they are not tested anywhere in the CPython.
I think that adding these test might be worth it, in case the setup is reliable.

Linked PRs

@sobolevn sobolevn added type-bug An unexpected behavior, bug, or error tests Tests in the Lib/test dir stdlib Python modules in the Lib dir labels Sep 1, 2023
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants
@sobolevn @hauntsaninja and others