Skip to content

Commit

Permalink
fix(tests): condition for key error, python command;
Browse files Browse the repository at this point in the history
- Added extra condition to catch possible key errors.
- Changed `python2` to just `python` in test class.
  • Loading branch information
JVickery-TBS committed Aug 22, 2023
1 parent c22253a commit 15f8dda
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ckanapi/cli/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ def reply(error, record=None):
if arguments['--insecure']:
requests_kwargs = {'verify': False}
include_users = False
if arguments['--include-users']:
if '--include-users' in arguments \
and arguments['--include-users']:
include_users = True
obj = ckan.call_action(thing_show, {'id': name,
'include_datasets': False,
Expand Down
3 changes: 2 additions & 1 deletion ckanapi/cli/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ def reply(action, error, response):
requests_kwargs = {'verify': False}

include_users = False
if arguments['--include-users']:
if '--include-users' in arguments \
and arguments['--include-users']:
include_users = True

if obj is not None:
Expand Down
2 changes: 1 addition & 1 deletion ckanapi/tests/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class TestRemoteAction(unittest.TestCase):
@classmethod
def setUpClass(cls):
script = os.path.join(os.path.dirname(__file__), 'mock/mock_ckan.py')
_mock_ckan = subprocess.Popen(['python2', script],
_mock_ckan = subprocess.Popen(['python', script],
stdout=DEVNULL, stderr=DEVNULL)
def kill_child():
try:
Expand Down

0 comments on commit 15f8dda

Please sign in to comment.