Skip to content

Commit 8f49641

Browse files
committed
Use a more unique name for fake module doctests
Change the tested "fake" module name from `fake` to `__fake__` to reduce the risk of collisions with real modules. This fixes test failures when the package is tested in a system environment where `fake.py` package is installed. Signed-off-by: Michał Górny <[email protected]>
1 parent a69dac5 commit 8f49641

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

CHANGES.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
6.1 (unreleased)
66
================
77

8-
- Nothing changed yet.
8+
- Fix test failures when ``fake.py`` package is installed.
99

1010

1111
6.0 (2025-09-12)

src/zope/testing/module.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ Importing
6868
Let's now imagine a more complicated example, were we actually want to
6969
be able to import the fake module as well:
7070

71-
>>> setUp(test, 'fake')
71+
>>> setUp(test, '__fake__')
7272
>>> a = 'Hello world'
7373

7474
The import should not fail:
7575

76-
>>> import fake
77-
>>> fake.a
76+
>>> import __fake__
77+
>>> __fake__.a
7878
'Hello world'
7979

8080
Let's tear it down again:
@@ -87,10 +87,10 @@ Let's tear it down again:
8787
.. doctest::
8888
:pyversion: < 3
8989

90-
>>> import fake
90+
>>> import __fake__
9191
Traceback (most recent call last):
9292
...
93-
ModuleNotFoundError: No module named 'fake'
93+
ModuleNotFoundError: No module named '__fake__'
9494

9595
If we enter a dotted name, it will actually try to place the fake
9696
module in that dotted name:

0 commit comments

Comments
 (0)