Skip to content

Commit

Permalink
Begin reworking tests
Browse files Browse the repository at this point in the history
Progress on #237
  • Loading branch information
alichtman committed Nov 14, 2019
1 parent c87ab1b commit d7d9452
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/test_backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def setup_method():

# Create all dotfiles and dotfolders
for file in DOTFILES:
print(f"Creating {file}")
with open(file, "w+") as f:
f.write(TEST_TEXT_CONTENT)

Expand All @@ -55,18 +56,20 @@ def setup_method():
@staticmethod
def teardown_method():
for folder in DIRS:
print(f"Removing {folder}")
shutil.rmtree(folder)

def test_backup_dotfiles(self):
"""
Test backing up dotfiles and dotfolders.
"""
dotfiles_path = os.path.join(BACKUP_DIR, "dotfiles")
backup_dotfiles(dotfiles_path, home_path=FAKE_HOME_DIR, skip=True)
assert os.path.isdir(dotfiles_path)
backup_dest_path = os.path.join(BACKUP_DIR, "dotfiles")
backup_dotfiles(backup_dest_path, home_path=FAKE_HOME_DIR, skip=True)
assert os.path.isdir(backup_dest_path)
for path in DOTFILES:
print("DOTFILES DIRECTORY CONTENTS:", os.listdir(dotfiles_path))
print(path + " being backed up.")
print(f"BACKUP DESTINATION DIRECTORY ({backup_dest_path}) CONTENTS:", os.listdir(backup_dest_path))
print(path + " should already be backed up.")
print("CWD:", os.getcwd())
backed_up_dot = os.path.join(dotfiles_path, os.path.split(path)[-1])
backed_up_dot = os.path.join(backup_dest_path, os.path.split(path)[-1])
print(f"Backed up dot: {backed_up_dot}")
assert os.path.isfile(backed_up_dot)

0 comments on commit d7d9452

Please sign in to comment.