Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Fix error in output for contents
This is a better solution for #71 (should replace #72).

We really don't want all that junk in the `contents` output anyway.
The purpose of that line to give the filename as part of the output, so
let's just give the filename.
  • Loading branch information
dwhswenson committed Sep 6, 2022
commit dcda827198cac0933465d95f11e49304f046dae9
7 changes: 6 additions & 1 deletion paths_cli/commands/contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ def contents(input_file, table):
command (i.e., to identify exactly how a state or engine is named.)
"""
storage = INPUT_FILE.get(input_file)
print(storage)
try:
print(storage.filename)
except AttributeError:
# TODO: this should be removed once SimStore has a `filename`
# attribute
print(storage)
if table is None:
report_all_tables(storage)
else:
Expand Down
8 changes: 4 additions & 4 deletions paths_cli/tests/commands/test_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_contents(tps_fixture):
results = runner.invoke(contents, ['setup.nc'])
cwd = os.getcwd()
expected = [
f"Storage @ '{cwd}/setup.nc'",
f"{cwd}/setup.nc",
"CVs: 1 item", "* x",
"Volumes: 8 items", "* A", "* B", "* plus 6 unnamed items",
"Engines: 2 items", "* flat", "* plus 1 unnamed item",
Expand Down Expand Up @@ -56,17 +56,17 @@ def test_contents_table(tps_fixture, table):
cwd = os.getcwd()
expected = {
'volumes': [
f"Storage @ '{cwd}/setup.nc'",
f"{cwd}/setup.nc",
"volumes: 8 items", "* A", "* B", "* plus 6 unnamed items",
""
],
'trajectories': [
f"Storage @ '{cwd}/setup.nc'",
f"{cwd}/setup.nc",
"trajectories: 1 unnamed item",
""
],
'tags': [
f"Storage @ '{cwd}/setup.nc'",
f"{cwd}/setup.nc",
"tags: 1 item",
"* initial_conditions",
""
Expand Down