Skip to content

Commit

Permalink
fix coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
rmorshea committed Jun 4, 2021
1 parent ba66b0f commit ca952f3
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/idom/client/_private.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,22 @@
IDOM_CLIENT_IMPORT_SOURCE_URL_INFIX = "/_snowpack/pkg"


if not IDOM_CLIENT_BUILD_DIR.current.exists():
# populate the runtime build directory if it doesn't exist
shutil.copytree(BACKUP_BUILD_DIR, IDOM_CLIENT_BUILD_DIR.current, symlinks=True)
elif getmtime(BACKUP_BUILD_DIR) > getmtime(IDOM_CLIENT_BUILD_DIR.current):
# delete the existing runtime build because it's out of date
shutil.rmtree(IDOM_CLIENT_BUILD_DIR.current)
# replace it with the newer backup build (presumable from a fresh install)
shutil.copytree(BACKUP_BUILD_DIR, IDOM_CLIENT_BUILD_DIR.current, symlinks=True)
def _run_build_dir_init_only_once(): # pragma: no cover
"""Initialize the runtime build directory
This should only be called *once*
"""
if not IDOM_CLIENT_BUILD_DIR.current.exists():
# populate the runtime build directory if it doesn't exist
shutil.copytree(BACKUP_BUILD_DIR, IDOM_CLIENT_BUILD_DIR.current, symlinks=True)
elif getmtime(BACKUP_BUILD_DIR) > getmtime(IDOM_CLIENT_BUILD_DIR.current):
# delete the existing runtime build because it's out of date
shutil.rmtree(IDOM_CLIENT_BUILD_DIR.current)
# replace it with the newer backup build (presumable from a fresh install)
shutil.copytree(BACKUP_BUILD_DIR, IDOM_CLIENT_BUILD_DIR.current, symlinks=True)


_run_build_dir_init_only_once() # this is only ever called once!


def get_user_packages_file(app_dir: Path) -> Path:
Expand Down

0 comments on commit ca952f3

Please sign in to comment.