Skip to content

Commit b430d8b

Browse files
authored
Merge pull request #73 from dwhswenson/fix-contents-iss71
Fix error in output for contents
2 parents f0c7722 + d570f5b commit b430d8b

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

paths_cli/commands/contents.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ def contents(input_file, table):
3737
command (i.e., to identify exactly how a state or engine is named.)
3838
"""
3939
storage = INPUT_FILE.get(input_file)
40-
print(storage)
40+
try:
41+
print(storage.filename)
42+
except AttributeError: # no-cov (temporary fix)
43+
# TODO: this should be removed once SimStore has a `filename`
44+
# attribute
45+
print(storage)
4146
if table is None:
4247
report_all_tables(storage)
4348
else:

paths_cli/tests/commands/test_contents.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_contents(tps_fixture):
2222
results = runner.invoke(contents, ['setup.nc'])
2323
cwd = os.getcwd()
2424
expected = [
25-
f"Storage @ '{cwd}/setup.nc'",
25+
f"{cwd}/setup.nc",
2626
"CVs: 1 item", "* x",
2727
"Volumes: 8 items", "* A", "* B", "* plus 6 unnamed items",
2828
"Engines: 2 items", "* flat", "* plus 1 unnamed item",
@@ -56,17 +56,17 @@ def test_contents_table(tps_fixture, table):
5656
cwd = os.getcwd()
5757
expected = {
5858
'volumes': [
59-
f"Storage @ '{cwd}/setup.nc'",
59+
f"{cwd}/setup.nc",
6060
"volumes: 8 items", "* A", "* B", "* plus 6 unnamed items",
6161
""
6262
],
6363
'trajectories': [
64-
f"Storage @ '{cwd}/setup.nc'",
64+
f"{cwd}/setup.nc",
6565
"trajectories: 1 unnamed item",
6666
""
6767
],
6868
'tags': [
69-
f"Storage @ '{cwd}/setup.nc'",
69+
f"{cwd}/setup.nc",
7070
"tags: 1 item",
7171
"* initial_conditions",
7272
""

0 commit comments

Comments
 (0)