Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weren't setting the path properly for the optional config parameter #252

Merged
merged 4 commits into from
Apr 10, 2019
Merged
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: 1 addition & 1 deletion startup.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ECHO Parsing parameters...
SET PYTHONPATH=%TABPY_ROOT%\tabpy-server;%TABPY_ROOT%\tabpy-tools;%PYTHONPATH%
SET STARTUP_CMD=python tabpy-server\tabpy_server\tabpy.py
IF [%1] NEQ [] (
ECHO Using config file at %TABPY_ROOT%\tabpy-server\tabpy_server\%1
ECHO Using config file at %1
SET STARTUP_CMD=%STARTUP_CMD% --config=%1
)

Expand Down
7 changes: 2 additions & 5 deletions tabpy-server/server_tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def test_no_config_file(self, mock_os, mock_file_exists,

getenv_calls = [call('TABPY_PORT', 9004),
call('TABPY_QUERY_OBJECT_PATH', '/tmp/query_objects'),
call('TABPY_STATE_PATH', './')]
call('TABPY_STATE_PATH',
'./tabpy-server/tabpy_server')]
mock_os.getenv.assert_has_calls(getenv_calls, any_order=True)
self.assertEqual(len(mock_file_exists.mock_calls), 2)
self.assertEqual(len(mock_psws.mock_calls), 1)
Expand Down Expand Up @@ -112,15 +113,11 @@ def raise_attribute_error():
def __init__(self, *args, **kwargs):
super(TestTransferProtocolValidation, self).__init__(*args, **kwargs)
self.fp = None
self.cwd = os.getcwd()
self.tabpy_cwd = os.path.join(self.cwd, 'tabpy-server', 'tabpy_server')

def setUp(self):
os.chdir(self.tabpy_cwd)
self.fp = NamedTemporaryFile(mode='w+t', delete=False)

def tearDown(self):
os.chdir(self.cwd)
os.remove(self.fp.name)
self.fp = None

Expand Down
5 changes: 0 additions & 5 deletions tabpy-server/server_tests/test_pwd_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,12 @@

class TestPasswordFile(unittest.TestCase):
def setUp(self):
self.cwd = pathlib.Path.cwd()
self.tabpy_cwd = self.cwd / 'tabpy-server' / 'tabpy_server'
os.chdir(self.tabpy_cwd)

self.config_file = NamedTemporaryFile(mode='w', delete=False)
self.config_file.close()
self.pwd_file = NamedTemporaryFile(mode='w', delete=False)
self.pwd_file.close()

def tearDown(self):
os.chdir(self.cwd)
os.remove(self.config_file.name)
self.config_file = None
os.remove(self.pwd_file.name)
Expand Down
3 changes: 2 additions & 1 deletion tabpy-server/tabpy_server/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ def set_parameter(settings_key,
# if state.ini does not exist try and create it - remove
# last dependence on batch/shell script
set_parameter('state_file_path', ConfigParameters.TABPY_STATE_PATH,
default_val='./', check_env_var=True)
default_val='./tabpy-server/tabpy_server',
check_env_var=True)
self.settings['state_file_path'] = os.path.realpath(
os.path.normpath(
os.path.expanduser(self.settings['state_file_path'])))
Expand Down