Skip to content

Commit

Permalink
Address PR comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
vyasr committed Mar 5, 2022
1 parent 5c211b4 commit 62d8920
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
8 changes: 5 additions & 3 deletions signac/contrib/migration/v1_to_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ def _migrate_v1_to_v2(root_directory):
v1_fn = os.path.join(root_directory, "signac.rc")
v2_fn = _get_project_config_fn(root_directory)
os.mkdir(os.path.dirname(v2_fn))
os.rename(v1_fn, v2_fn)
os.replace(v1_fn, v2_fn)

# Now move all other files.
files_to_move = {
".signac_shell_history": os.sep.join((".signac", "shell_history")),
".signac_sp_cache.json.gz": os.sep.join((".signac", "sp_cache.json.gz")),
".signac_sp_cache.json.gz": os.sep.join(
(".signac", "statepoint_cache.json.gz")
),
}
for src, dst in files_to_move.items():
os.rename(
os.replace(
os.sep.join((root_directory, src)), os.sep.join((root_directory, dst))
)
2 changes: 1 addition & 1 deletion signac/contrib/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class Project:
KEY_DATA = "signac_data"
"The project's datastore key."

FN_CACHE = os.sep.join((".signac", "sp_cache.json.gz"))
FN_CACHE = os.sep.join((".signac", "statepoint_cache.json.gz"))
"The default filename for the state point cache file."

_use_pandas_for_html_repr = True # toggle use of pandas for html repr
Expand Down
10 changes: 2 additions & 8 deletions tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from test_job import TestJobBase

import signac
from signac.__main__ import SHELL_HISTORY_FN
from signac.common.config import (
PROJECT_CONFIG_FN,
_get_project_config_fn,
Expand Down Expand Up @@ -2498,12 +2497,7 @@ def test_project_schema_version_migration(self, implicit_version):
# Create a shell history file.
history_fn = os.path.join(dirname, ".signac_shell_history")
with open(history_fn, "w") as f:
f.write(
textwrap.dedent(
"""\
print(project)"""
)
)
f.write("print(project)")

# Create a statepoint cache. Note that this cache does not
# correspond to actual statepoints since we don't currently have
Expand Down Expand Up @@ -2534,7 +2528,7 @@ def test_project_schema_version_migration(self, implicit_version):
assert "0 to 1" in err.getvalue()
assert "1 to 2" in err.getvalue()
assert os.path.isfile(project.fn(PROJECT_CONFIG_FN))
assert os.path.isfile(project.fn(SHELL_HISTORY_FN))
assert os.path.isfile(project.fn(os.sep.join((".signac", "shell_history"))))
assert os.path.isfile(project.fn(Project.FN_CACHE))


Expand Down

0 comments on commit 62d8920

Please sign in to comment.