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

Skip to content

Commit 231c5da

Browse files
committed
Determine test_path if not specified
1 parent 1c23016 commit 231c5da

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

testgres/node.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,9 +1672,17 @@ def _get_bin_path(self, filename):
16721672

16731673
class NodeApp:
16741674

1675-
def __init__(self, test_path, nodes_to_cleanup, os_ops=LocalOperations()):
1676-
self.test_path = test_path
1677-
self.nodes_to_cleanup = nodes_to_cleanup
1675+
def __init__(self, test_path=None, nodes_to_cleanup=None, os_ops=LocalOperations()):
1676+
print('ALEXEY in nodeapp init', test_path)
1677+
if test_path:
1678+
if os.path.isabs(test_path):
1679+
self.test_path = test_path
1680+
else:
1681+
self.test_path = os.path.join(os_ops.cwd(), test_path)
1682+
else:
1683+
self.test_path = os_ops.cwd()
1684+
print('ALEXEY in nodeapp resulting test path', self.test_path)
1685+
self.nodes_to_cleanup = nodes_to_cleanup if nodes_to_cleanup else []
16781686
self.os_ops = os_ops
16791687

16801688
def make_empty(

testgres/operations/os_ops.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import getpass
22
import locale
3+
import sys
34

45
try:
56
import psycopg2 as pglib # noqa: F401
@@ -35,6 +36,11 @@ def exec_command(self, cmd, **kwargs):
3536
def environ(self, var_name):
3637
raise NotImplementedError()
3738

39+
def cwd(self):
40+
if sys.platform == 'win32':
41+
raise NotImplementedError()
42+
return self.exec_command('pwd').decode().rstrip()
43+
3844
def find_executable(self, executable):
3945
raise NotImplementedError()
4046

0 commit comments

Comments
 (0)