Skip to content

Commit 5d0c52b

Browse files
committed
Change uses of "folder" to "directory"
It's good to use consistent terminology, especially in the docs. "Directory" is more popular and more ingrained (e.g. in pathlib, `Dir`/`Directory` nodes, etc.). so let's go with that.
1 parent 578fd03 commit 5d0c52b

File tree

13 files changed

+35
-35
lines changed

13 files changed

+35
-35
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ If this change fixes an issue, please:
1313
1414
Unless your change is trivial or a small documentation fix (e.g., a typo or reword of a small section) please:
1515
16-
- [ ] Create a new changelog file in the `changelog` folder, with a name like `<ISSUE NUMBER>.<TYPE>.rst`. See [changelog/README.rst](https://github.com/pytest-dev/pytest/blob/main/changelog/README.rst) for details.
16+
- [ ] Create a new changelog file in the `changelog` directory, with a name like `<ISSUE NUMBER>.<TYPE>.rst`. See [changelog/README.rst](https://github.com/pytest-dev/pytest/blob/main/changelog/README.rst) for details.
1717
1818
Write sentences in the **past or present tense**, examples:
1919

doc/en/changelog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ with advance notice in the **Deprecations** section of releases.
1616
fix problems like typo corrections or such.
1717
To add a new change log entry, please see
1818
https://pip.pypa.io/en/latest/development/contributing/#news-entries
19-
we named the news folder changelog
19+
but note that in pytest the "news/" directory is named "changelog/".
2020
2121

2222
.. only:: not is_release

doc/en/explanation/fixtures.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ If you want to make test data from files available to your tests, a good way
152152
to do this is by loading these data in a fixture for use by your tests.
153153
This makes use of the automatic caching mechanisms of pytest.
154154

155-
Another good approach is by adding the data files in the ``tests`` folder.
155+
Another good approach is by adding the data files in the ``tests`` directory.
156156
There are also community plugins available to help to manage this aspect of
157157
testing, e.g. :pypi:`pytest-datadir` and :pypi:`pytest-datafiles`.
158158

doc/en/explanation/goodpractices.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ This results in a drawback compared to the import mode ``importlib``:
240240
your test files must have **unique names**.
241241

242242
If you need to have test modules with the same name,
243-
as a workaround you might add ``__init__.py`` files to your ``tests`` folder and subfolders,
243+
as a workaround you might add ``__init__.py`` files to your ``tests`` directory and subdirectories,
244244
changing them to packages:
245245

246246
.. code-block:: text

doc/en/explanation/pythonpath.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ When executing:
143143
pytest root/
144144
145145
pytest will find ``foo/bar/tests/test_foo.py`` and realize it is part of a package given that
146-
there's an ``__init__.py`` file in the same folder. It will then search upwards until it can find the
147-
last folder which still contains an ``__init__.py`` file in order to find the package *root* (in
146+
there's an ``__init__.py`` file in the same directory. It will then search upwards until it can find the
147+
last directory which still contains an ``__init__.py`` file in order to find the package *root* (in
148148
this case ``foo/``). To load the module, it will insert ``root/`` to the front of
149149
:py:data:`sys.path` (if not there already) in order to load
150150
``test_foo.py`` as the *module* ``foo.bar.tests.test_foo``.
@@ -175,7 +175,7 @@ When executing:
175175
pytest root/
176176
177177
pytest will find ``foo/bar/tests/test_foo.py`` and realize it is NOT part of a package given that
178-
there's no ``__init__.py`` file in the same folder. It will then add ``root/foo/bar/tests`` to
178+
there's no ``__init__.py`` file in the same directory. It will then add ``root/foo/bar/tests`` to
179179
:py:data:`sys.path` in order to import ``test_foo.py`` as the *module* ``test_foo``. The same is done
180180
with the ``conftest.py`` file by adding ``root/foo`` to :py:data:`sys.path` to import it as ``conftest``.
181181

doc/en/how-to/fixtures.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,10 +1761,10 @@ Overriding fixtures on various levels
17611761
-------------------------------------
17621762

17631763
In relatively large test suite, you may want to *override* a fixture, to augment
1764-
or change its behavior inside of certain test modules or folders.
1764+
or change its behavior inside of certain test modules or directories.
17651765

1766-
Override a fixture on a folder (conftest) level
1767-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1766+
Override a fixture on a directory (conftest) level
1767+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17681768

17691769
Given the tests file structure is:
17701770

@@ -1784,21 +1784,21 @@ Given the tests file structure is:
17841784
def test_username(username):
17851785
assert username == 'username'
17861786

1787-
subfolder/
1787+
subdir/
17881788
conftest.py
1789-
# content of tests/subfolder/conftest.py
1789+
# content of tests/subdir/conftest.py
17901790
import pytest
17911791

17921792
@pytest.fixture
17931793
def username(username):
17941794
return 'overridden-' + username
17951795

17961796
test_something_else.py
1797-
# content of tests/subfolder/test_something_else.py
1797+
# content of tests/subdir/test_something_else.py
17981798
def test_username(username):
17991799
assert username == 'overridden-username'
18001800

1801-
As you can see, a fixture with the same name can be overridden for certain test folder level.
1801+
As you can see, a fixture with the same name can be overridden for certain test directory level.
18021802
Note that the ``base`` or ``super`` fixture can be accessed from the ``overriding``
18031803
fixture easily - used in the example above.
18041804

@@ -1927,7 +1927,7 @@ Given the tests file structure is:
19271927

19281928
In the example above, a parametrized fixture is overridden with a non-parametrized version, and
19291929
a non-parametrized fixture is overridden with a parametrized version for certain test module.
1930-
The same applies for the test folder level obviously.
1930+
The same applies for the test directory level obviously.
19311931

19321932

19331933
Using fixtures from other projects

doc/en/reference/customize.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ check for configuration files as follows:
272272

273273
Custom pytest plugin commandline arguments may include a path, as in
274274
``pytest --log-output ../../test.log args``. Then ``args`` is mandatory,
275-
otherwise pytest uses the folder of test.log for rootdir determination
275+
otherwise pytest uses the directory of test.log for rootdir determination
276276
(see also :issue:`1435`).
277277
A dot ``.`` for referencing to the current working directory is also
278278
possible.

src/_pytest/pathlib.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def _force_symlink(root: Path, target: str | PurePath, link_to: str | Path) -> N
225225
def make_numbered_dir(root: Path, prefix: str, mode: int = 0o700) -> Path:
226226
"""Create a directory with an increased number as suffix for the given prefix."""
227227
for i in range(10):
228-
# try up to 10 times to create the folder
228+
# try up to 10 times to create the directory
229229
max_existing = max(map(parse_num, find_suffixes(root, prefix)), default=-1)
230230
new_number = max_existing + 1
231231
new_path = root.joinpath(f"{prefix}{new_number}")
@@ -244,7 +244,7 @@ def make_numbered_dir(root: Path, prefix: str, mode: int = 0o700) -> Path:
244244

245245

246246
def create_cleanup_lock(p: Path) -> Path:
247-
"""Create a lock to prevent premature folder cleanup."""
247+
"""Create a lock to prevent premature directory cleanup."""
248248
lock_path = get_lock_path(p)
249249
try:
250250
fd = os.open(str(lock_path), os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o644)
@@ -294,7 +294,7 @@ def maybe_delete_a_numbered_dir(path: Path) -> None:
294294
except OSError:
295295
# known races:
296296
# * other process did a cleanup at the same time
297-
# * deletable folder was found
297+
# * deletable directory was found
298298
# * process cwd (Windows)
299299
return
300300
finally:
@@ -336,7 +336,7 @@ def ensure_deletable(path: Path, consider_lock_dead_if_created_before: float) ->
336336

337337

338338
def try_cleanup(path: Path, consider_lock_dead_if_created_before: float) -> None:
339-
"""Try to cleanup a folder if we can ensure it's deletable."""
339+
"""Try to cleanup a directory if we can ensure it's deletable."""
340340
if ensure_deletable(path, consider_lock_dead_if_created_before):
341341
maybe_delete_a_numbered_dir(path)
342342

testing/example_scripts/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Example test scripts
22
=====================
33

44

5-
The files in this folder are not direct tests, but rather example test suites that demonstrate certain issues/behaviours.
5+
The files in this directory are not direct tests, but rather example test suites that demonstrate certain issues/behaviours.
66

77
In the future we will move part of the content of the acceptance tests here in order to have directly testable code instead of writing out things and then running them in nested pytest sessions/subprocesses.
88

testing/plugins_integration/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
This folder contains tests and support files for smoke testing popular plugins against the current pytest version.
1+
This directory contains tests and support files for smoke testing popular plugins against the current pytest version.
22

33
The objective is to gauge if any intentional or unintentional changes in pytest break plugins.
44

0 commit comments

Comments
 (0)