Skip to content

Commit 1a662f1

Browse files
[FIX] Tests include testgres by right way through import (#241)
When we do not have root __init__.py tests must to import testgres through "import testgres" not through "from <relative_path> import testgres"
1 parent 6e5e4f5 commit 1a662f1

File tree

9 files changed

+59
-59
lines changed

9 files changed

+59
-59
lines changed

‎testgres/plugins/pg_probackup2/pg_probackup2/tests/test_basic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import shutil
55
import pytest
66

7-
from ...... import testgres
7+
import testgres
88
from ...pg_probackup2.app import ProbackupApp
99
from ...pg_probackup2.init_helpers import Init, init_params
1010
from ..storage.fs_backup import FSTestBackupDir

‎tests/helpers/global_data.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
from ...testgres.operations.os_ops import OsOperations
2-
from ...testgres.operations.os_ops import ConnectionParams
3-
from ...testgres.operations.local_ops import LocalOperations
4-
from ...testgres.operations.remote_ops import RemoteOperations
5-
6-
from ...testgres.node import PortManager
7-
from ...testgres.node import PortManager__ThisHost
8-
from ...testgres.node import PortManager__Generic
1+
from testgres.operations.os_ops import OsOperations
2+
from testgres.operations.os_ops import ConnectionParams
3+
from testgres.operations.local_ops import LocalOperations
4+
from testgres.operations.remote_ops import RemoteOperations
5+
6+
from testgres.node import PortManager
7+
from testgres.node import PortManager__ThisHost
8+
from testgres.node import PortManager__Generic
99

1010
import os
1111

‎tests/test_config.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
from ..testgres import TestgresConfig
2-
from ..testgres import configure_testgres
3-
from ..testgres import scoped_config
4-
from ..testgres import pop_config
1+
from testgres import TestgresConfig
2+
from testgres import configure_testgres
3+
from testgres import scoped_config
4+
from testgres import pop_config
55

6-
from .. import testgres
6+
import testgres
77

88
import pytest
99

‎tests/test_os_ops_common.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
import threading
1515
import typing
1616

17-
from ..testgres import InvalidOperationException
18-
from ..testgres import ExecUtilException
17+
from testgres import InvalidOperationException
18+
from testgres import ExecUtilException
1919

2020

2121
class TestOsOpsCommon:

‎tests/test_os_ops_remote.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from .helpers.global_data import OsOpsDescrs
44
from .helpers.global_data import OsOperations
55

6-
from ..testgres import ExecUtilException
6+
from testgres import ExecUtilException
77

88
import os
99
import pytest

‎tests/test_testgres_common.py

+20-20
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,29 @@
33
from .helpers.global_data import OsOperations
44
from .helpers.global_data import PortManager
55

6-
from ..testgres.node import PgVer
7-
from ..testgres.node import PostgresNode
8-
from ..testgres.utils import get_pg_version2
9-
from ..testgres.utils import file_tail
10-
from ..testgres.utils import get_bin_path2
11-
from ..testgres import ProcessType
12-
from ..testgres import NodeStatus
13-
from ..testgres import IsolationLevel
6+
from testgres.node import PgVer
7+
from testgres.node import PostgresNode
8+
from testgres.utils import get_pg_version2
9+
from testgres.utils import file_tail
10+
from testgres.utils import get_bin_path2
11+
from testgres import ProcessType
12+
from testgres import NodeStatus
13+
from testgres import IsolationLevel
1414

1515
# New name prevents to collect test-functions in TestgresException and fixes
1616
# the problem with pytest warning.
17-
from ..testgres import TestgresException as testgres_TestgresException
18-
19-
from ..testgres import InitNodeException
20-
from ..testgres import StartNodeException
21-
from ..testgres import QueryException
22-
from ..testgres import ExecUtilException
23-
from ..testgres import TimeoutException
24-
from ..testgres import InvalidOperationException
25-
from ..testgres import BackupException
26-
from ..testgres import ProgrammingError
27-
from ..testgres import scoped_config
28-
from ..testgres import First, Any
17+
from testgres import TestgresException as testgres_TestgresException
18+
19+
from testgres import InitNodeException
20+
from testgres import StartNodeException
21+
from testgres import QueryException
22+
from testgres import ExecUtilException
23+
from testgres import TimeoutException
24+
from testgres import InvalidOperationException
25+
from testgres import BackupException
26+
from testgres import ProgrammingError
27+
from testgres import scoped_config
28+
from testgres import First, Any
2929

3030
from contextlib import contextmanager
3131

‎tests/test_testgres_local.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@
77
import platform
88
import logging
99

10-
from .. import testgres
10+
import testgres
1111

12-
from ..testgres import StartNodeException
13-
from ..testgres import ExecUtilException
14-
from ..testgres import NodeApp
15-
from ..testgres import scoped_config
16-
from ..testgres import get_new_node
17-
from ..testgres import get_bin_path
18-
from ..testgres import get_pg_config
19-
from ..testgres import get_pg_version
12+
from testgres import StartNodeException
13+
from testgres import ExecUtilException
14+
from testgres import NodeApp
15+
from testgres import scoped_config
16+
from testgres import get_new_node
17+
from testgres import get_bin_path
18+
from testgres import get_pg_config
19+
from testgres import get_pg_version
2020

2121
# NOTE: those are ugly imports
22-
from ..testgres.utils import bound_ports
23-
from ..testgres.utils import PgVer
24-
from ..testgres.node import ProcessProxy
22+
from testgres.utils import bound_ports
23+
from testgres.utils import PgVer
24+
from testgres.node import ProcessProxy
2525

2626

2727
def pg_version_ge(version):

‎tests/test_testgres_remote.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
from .helpers.global_data import PostgresNodeService
88
from .helpers.global_data import PostgresNodeServices
99

10-
from .. import testgres
10+
import testgres
1111

12-
from ..testgres.exceptions import InitNodeException
13-
from ..testgres.exceptions import ExecUtilException
12+
from testgres.exceptions import InitNodeException
13+
from testgres.exceptions import ExecUtilException
1414

15-
from ..testgres.config import scoped_config
16-
from ..testgres.config import testgres_config
15+
from testgres.config import scoped_config
16+
from testgres.config import testgres_config
1717

18-
from ..testgres import get_bin_path
19-
from ..testgres import get_pg_config
18+
from testgres import get_bin_path
19+
from testgres import get_pg_config
2020

2121
# NOTE: those are ugly imports
2222

‎tests/test_utils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
from .helpers.global_data import OsOpsDescrs
33
from .helpers.global_data import OsOperations
44

5-
from ..testgres.utils import parse_pg_version
6-
from ..testgres.utils import get_pg_config2
7-
from ..testgres import scoped_config
5+
from testgres.utils import parse_pg_version
6+
from testgres.utils import get_pg_config2
7+
from testgres import scoped_config
88

99
import pytest
1010
import typing

0 commit comments

Comments
 (0)