Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions testgres/operations/local_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def _run_command__nt(self, cmd, shell, input, stdin, stdout, stderr, get_process
process = subprocess.Popen(
cmd,
shell=shell,
cwd=self.cwd,
stdin=stdin or subprocess.PIPE if input is not None else None,
stdout=stdout,
stderr=stderr,
Expand Down Expand Up @@ -151,6 +152,7 @@ def _run_command__generic(self, cmd, shell, input, stdin, stdout, stderr, get_pr
process = subprocess.Popen(
cmd,
shell=shell,
cwd=self.cwd,
stdin=stdin or subprocess.PIPE if input is not None else None,
stdout=stdout or subprocess.PIPE,
stderr=stderr or subprocess.PIPE,
Expand Down
6 changes: 6 additions & 0 deletions testgres/operations/os_ops.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import getpass
import locale
import os


class ConnectionParams:
Expand All @@ -18,6 +19,7 @@ def get_default_encoding():

class OsOperations:
def __init__(self, username=None):
self.cwd = os.getcwd()
self.ssh_key = None
self.username = username or getpass.getuser()

Expand Down Expand Up @@ -133,3 +135,7 @@ def is_port_free(self, number: int):

def get_tempdir(self) -> str:
raise NotImplementedError()

def set_cwd(self, cwd):
if cwd:
self.cwd = cwd