Skip to content

Commit d3ea0f9

Browse files
committed
refactor!(test[constants]) Move to test.constants
1 parent 044431a commit d3ea0f9

File tree

7 files changed

+24
-10
lines changed

7 files changed

+24
-10
lines changed

src/libtmux/pytest_plugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313

1414
from libtmux import exc
1515
from libtmux.server import Server
16-
from libtmux.test import TEST_SESSION_PREFIX, get_test_session_name, namer
16+
from libtmux.test import get_test_session_name, namer
17+
from libtmux.test.constants import TEST_SESSION_PREFIX
1718

1819
if t.TYPE_CHECKING:
1920
import pathlib

src/libtmux/test/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
import typing as t
1212

1313
from libtmux.exc import WaitTimeout
14+
from libtmux.test.constants import (
15+
RETRY_INTERVAL_SECONDS,
16+
RETRY_TIMEOUT_SECONDS,
17+
TEST_SESSION_PREFIX,
18+
)
1419

1520
logger = logging.getLogger(__name__)
1621

@@ -29,11 +34,6 @@
2934
from typing_extensions import Self
3035

3136

32-
TEST_SESSION_PREFIX = "libtmux_"
33-
RETRY_TIMEOUT_SECONDS = int(os.getenv("RETRY_TIMEOUT_SECONDS", 8))
34-
RETRY_INTERVAL_SECONDS = float(os.getenv("RETRY_INTERVAL_SECONDS", 0.05))
35-
36-
3737
class RandomStrSequence:
3838
"""Factory to generate random string."""
3939

src/libtmux/test/constants.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""Constants for libtmux test helpers."""
2+
3+
from __future__ import annotations
4+
5+
import os
6+
7+
TEST_SESSION_PREFIX = "libtmux_"
8+
RETRY_TIMEOUT_SECONDS = int(os.getenv("RETRY_TIMEOUT_SECONDS", 8))
9+
RETRY_INTERVAL_SECONDS = float(os.getenv("RETRY_INTERVAL_SECONDS", 0.05))

tests/legacy_api/test_session.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
from libtmux.common import has_gte_version, has_lt_version
1313
from libtmux.pane import Pane
1414
from libtmux.session import Session
15-
from libtmux.test import TEST_SESSION_PREFIX, namer
15+
from libtmux.test import namer
16+
from libtmux.test.constants import TEST_SESSION_PREFIX
1617
from libtmux.window import Window
1718

1819
if t.TYPE_CHECKING:

tests/legacy_api/test_tmuxobject.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
from libtmux.pane import Pane
99
from libtmux.session import Session
10-
from libtmux.test import TEST_SESSION_PREFIX, namer
10+
from libtmux.test import namer
11+
from libtmux.test.constants import TEST_SESSION_PREFIX
1112
from libtmux.window import Window
1213

1314
if t.TYPE_CHECKING:

tests/test_session.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
from libtmux.constants import WindowDirection
1414
from libtmux.pane import Pane
1515
from libtmux.session import Session
16-
from libtmux.test import TEST_SESSION_PREFIX, namer
16+
from libtmux.test import namer
17+
from libtmux.test.constants import TEST_SESSION_PREFIX
1718
from libtmux.window import Window
1819

1920
if t.TYPE_CHECKING:

tests/test_tmuxobject.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
from libtmux.pane import Pane
99
from libtmux.session import Session
10-
from libtmux.test import TEST_SESSION_PREFIX, namer
10+
from libtmux.test import namer
11+
from libtmux.test.constants import TEST_SESSION_PREFIX
1112
from libtmux.window import Window
1213

1314
if t.TYPE_CHECKING:

0 commit comments

Comments
 (0)