Skip to content

Commit

Permalink
Catch process errors in CLI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ElliottKasoar committed Jan 24, 2024
1 parent d1fad7e commit 83e678d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tests/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import subprocess
import unittest
import logging
from time import sleep
Expand Down Expand Up @@ -26,16 +27,19 @@ def setUpClass(cls):
if not cls.security_enabled:
url += " --disable_ssl"
try:
os.system(f"abcd login {url}")
except (ConnectionError, ConnectionResetError):
subprocess.run(f"abcd login {url}", shell=True, check=True)
except subprocess.CalledProcessError:
sleep(10)
os.system(f"abcd login {url}")
subprocess.run(f"abcd login {url}", shell=True, check=True)

def test_summary(self):
"""
Test summary output of stored data.
Test summary output of uploaded data file.
"""
class_path = os.path.normpath(os.path.abspath(__file__))
data_file = os.path.dirname(class_path) + "/data/example.xyz"
os.system(f"abcd upload {data_file}")
os.system("abcd summary")
subprocess.run(f"abcd upload {data_file}", shell=True, check=True)
summary = subprocess.run(
"abcd summary", shell=True, check=True, capture_output=True, text=True
)
assert "Total number of configurations: 1" in summary.stdout

0 comments on commit 83e678d

Please sign in to comment.