Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e6f4448

Browse files
Total refactoring of tests
- TestgresRemoteTests does not use global variables and code - Explicit work with ..testgres folder
1 parent a14b3d7 commit e6f4448

File tree

5 files changed

+116
-99
lines changed

5 files changed

+116
-99
lines changed

run_tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ export VIRTUAL_ENV_DISABLE_PROMPT=1
2222
source $VENV_PATH/bin/activate
2323

2424
# install utilities
25-
$PIP install coverage flake8 psutil Sphinx pytest pytest-xdist
25+
$PIP install coverage flake8 psutil Sphinx pytest pytest-xdist psycopg2 six psutil
2626

2727
# install testgres' dependencies
2828
export PYTHONPATH=$(pwd)
29-
$PIP install .
29+
# $PIP install .
3030

3131
# test code quality
3232
flake8 .

tests/test_local.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import re
55
import tempfile
66

7-
from testgres import ExecUtilException
8-
from testgres import InvalidOperationException
9-
from testgres import LocalOperations
7+
from ..testgres import ExecUtilException
8+
from ..testgres import InvalidOperationException
9+
from ..testgres import LocalOperations
1010

1111
from .helpers.run_conditions import RunConditions
1212

tests/test_remote.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
import re
55
import tempfile
66

7-
from testgres import ExecUtilException
8-
from testgres import InvalidOperationException
9-
from testgres import RemoteOperations
10-
from testgres import ConnectionParams
7+
from ..testgres import ExecUtilException
8+
from ..testgres import InvalidOperationException
9+
from ..testgres import RemoteOperations
10+
from ..testgres import ConnectionParams
1111

1212

1313
class TestRemoteOperations:

tests/test_simple.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import re
33
import subprocess
44
import tempfile
5-
import testgres
65
import time
76
import six
87
import pytest
@@ -14,7 +13,9 @@
1413
from contextlib import contextmanager
1514
from shutil import rmtree
1615

17-
from testgres import \
16+
from .. import testgres
17+
18+
from ..testgres import \
1819
InitNodeException, \
1920
StartNodeException, \
2021
ExecUtilException, \
@@ -25,31 +26,32 @@
2526
InvalidOperationException, \
2627
NodeApp
2728

28-
from testgres import \
29+
from ..testgres import \
2930
TestgresConfig, \
3031
configure_testgres, \
3132
scoped_config, \
3233
pop_config
3334

34-
from testgres import \
35+
from ..testgres import \
3536
NodeStatus, \
3637
ProcessType, \
3738
IsolationLevel, \
3839
get_new_node
3940

40-
from testgres import \
41+
from ..testgres import \
4142
get_bin_path, \
4243
get_pg_config, \
4344
get_pg_version
4445

45-
from testgres import \
46+
from ..testgres import \
4647
First, \
4748
Any
4849

4950
# NOTE: those are ugly imports
50-
from testgres import bound_ports
51-
from testgres.utils import PgVer, parse_pg_version
52-
from testgres.node import ProcessProxy
51+
from ..testgres import bound_ports
52+
from ..testgres.utils import PgVer, parse_pg_version
53+
from ..testgres.utils import file_tail
54+
from ..testgres.node import ProcessProxy
5355

5456

5557
def pg_version_ge(version):
@@ -874,8 +876,6 @@ def test_auto_name(self):
874876
assert ('testgres' in r.name)
875877

876878
def test_file_tail(self):
877-
from testgres.utils import file_tail
878-
879879
s1 = "the quick brown fox jumped over that lazy dog\n"
880880
s2 = "abc\n"
881881
s3 = "def\n"

0 commit comments

Comments
 (0)