Skip to content

test.py: Split into test/ #578

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

Merged
merged 12 commits into from
Feb 23, 2025
Merged
35 changes: 35 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,41 @@ $ pip install --user --upgrade --pre libtmux

- _Future release notes will be placed here_

### Breaking Changes

#### Test helpers: Refactor

Test helper functionality has been split into focused modules (#XXX):

- `libtmux.test` module split into:
- `libtmux.test.constants`: Test-related constants (`TEST_SESSION_PREFIX`, etc.)
- `libtmux.test.environment`: Environment variable mocking
- `libtmux.test.random`: Random string generation utilities
- `libtmux.test.temporary`: Temporary session/window management

**Breaking**: Import paths have changed. Update imports:

```python
# Old (0.45.x and earlier)
from libtmux.test import (
TEST_SESSION_PREFIX,
get_test_session_name,
get_test_window_name,
namer,
temp_session,
temp_window,
EnvironmentVarGuard,
)
```

```python
# New (0.46.0+)
from libtmux.test.constants import TEST_SESSION_PREFIX
from libtmux.test.environment import EnvironmentVarGuard
from libtmux.test.random import get_test_session_name, get_test_window_name, namer
from libtmux.test.temporary import temp_session, temp_window
```

### Development

- CI: Check for runtime dependencies (#574)
Expand Down
35 changes: 35 additions & 0 deletions MIGRATION
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,41 @@ _Detailed migration steps for the next version will be posted here._

<!-- To the maintainers and contributors: please add migration details for the upcoming release here -->

## libtmux 0.45.x (Yet to be released)

### Test helpers: Module moves

Test helper functionality has been split into focused modules (#XXX):

- `libtmux.test` module split into:
- `libtmux.test.constants`: Test-related constants (`TEST_SESSION_PREFIX`, etc.)
- `libtmux.test.environment`: Environment variable mocking
- `libtmux.test.random`: Random string generation utilities
- `libtmux.test.temporary`: Temporary session/window management

**Breaking**: Import paths have changed. Update imports:

```python
# Old (0.45.x and earlier)
from libtmux.test import (
TEST_SESSION_PREFIX,
get_test_session_name,
get_test_window_name,
namer,
temp_session,
temp_window,
EnvironmentVarGuard,
)
```

```python
# New (0.46.0+)
from libtmux.test.constants import TEST_SESSION_PREFIX
from libtmux.test.environment import EnvironmentVarGuard
from libtmux.test.random import get_test_session_name, get_test_window_name, namer
from libtmux.test.temporary import temp_session, temp_window
```

## 0.35.0: Commands require explicit targets (2024-03-17)

### Commands require explicit targets (#535)
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ required-imports = [
[tool.ruff.lint.flake8-builtins]
builtins-allowed-modules = [
"dataclasses",
"random",
"types",
]

Expand Down
3 changes: 2 additions & 1 deletion src/libtmux/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

from libtmux import exc
from libtmux.server import Server
from libtmux.test import TEST_SESSION_PREFIX, get_test_session_name, namer
from libtmux.test.constants import TEST_SESSION_PREFIX
from libtmux.test.random import get_test_session_name, namer

if t.TYPE_CHECKING:
import pathlib
Expand Down
Loading