Skip to content

Commit

Permalink
Merge pull request #1 from boegel/initgitrepo
Browse files Browse the repository at this point in the history
enhance test for --new-pr to make sure that repo is cloned from working copy rather than copied (so unstaged files are ignored)
  • Loading branch information
lexming authored Oct 30, 2019
2 parents 794c415 + 66663e3 commit 935a521
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/framework/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -2879,6 +2879,10 @@ def test_new_update_pr(self):
]
self._assert_regexs(regexs, txt)

# add unstaged file to git working dir, to check on later
unstaged_file = os.path.join('easybuild-easyconfigs', 'easybuild', 'easyconfigs', 'test.eb')
write_file(os.path.join(git_working_dir, unstaged_file), 'test123')

# a custom commit message is required when doing more than just adding new easyconfigs (e.g., deleting a file)
args.extend([
'--git-working-dirs-path=%s' % git_working_dir,
Expand All @@ -2890,6 +2894,15 @@ def test_new_update_pr(self):
self.assertErrorRegex(EasyBuildError, error_msg, self.eb_main, args, raise_error=True, testing=False)
self.mock_stdout(False)

# check whether unstaged file in git working dir was copied (it shouldn't)
res = glob.glob(os.path.join(self.test_prefix, 'eb-*', 'eb-*', 'git-working-dir*'))
res = [d for d in res if os.path.basename(d) != os.path.basename(git_working_dir)]
if len(res) == 1:
unstaged_file_full = os.path.join(res[0], unstaged_file)
self.assertFalse(os.path.exists(unstaged_file_full), "%s not found in %s" % (unstaged_file, res[0]))
else:
self.assertTrue(False, "Found copy of easybuild-easyconfigs working copy")

# add required commit message, try again
args.append('--pr-commit-msg=just a test')
txt, _ = self._run_mock_eb(args, do_build=True, raise_error=True, testing=False)
Expand Down

0 comments on commit 935a521

Please sign in to comment.