Skip to content

Commit 0dc9577

Browse files
committed
Break the test suite again! (to uncover a programming error)
1 parent 86798fd commit 0dc9577

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

vcs_repo_mgr/tests.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,10 @@ def test_ensure_exists(self):
591591
def test_export(self):
592592
"""Test exporting of revisions."""
593593
with TemporaryDirectory() as directory:
594+
# Change the current working directory to our temporary directory
595+
# so that we can give a relative pathname to export(). This is a
596+
# regression test for a bug to be fixed in vcs-repo-mgr 4.1.3.
597+
os.chdir(directory)
594598
# Initialize a repository object of the parametrized type.
595599
repository = self.get_instance(bare=False, local=os.path.join(directory, 'repo'))
596600
repository.create()
@@ -604,17 +608,20 @@ def test_export(self):
604608
message="Initial commit",
605609
)
606610
# Export the initial revision.
607-
export_directory = os.path.join(directory, 'export')
611+
export_directory_relative = 'export'
612+
export_directory_absolute = os.path.join(directory, export_directory_relative)
608613
returncode, output = run_cli(
609614
main, '--repository=%s' % repository.local,
610-
'--export=%s' % export_directory,
615+
'--export=%s' % export_directory_relative,
611616
)
612617
self.assertEquals(returncode, 0)
613618
# Check that the file we committed was exported.
614-
exported_file = os.path.join(export_directory, versioned_filename)
619+
exported_file = os.path.join(export_directory_absolute, versioned_filename)
615620
self.assertTrue(os.path.isfile(exported_file))
616621
with codecs.open(exported_file, 'r', 'UTF-8') as handle:
617622
self.assertEquals(handle.read(), versioned_contents)
623+
# Reset the working directory.
624+
os.chdir(tempfile.gettempdir())
618625

619626
def test_find_revision_number(self):
620627
"""Test querying the command line interface for local revision numbers."""

0 commit comments

Comments
 (0)