diff options
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | lib/fixtures/_fixtures/tempdir.py | 2 | ||||
-rw-r--r-- | lib/fixtures/tests/_fixtures/test_tempdir.py | 12 |
3 files changed, 8 insertions, 8 deletions
@@ -8,7 +8,7 @@ NEXT CHANGES: -* Add ``abspath`` method to ``TempDir`` to more readily get paths relative +* Add ``join`` method to ``TempDir`` to more readily get paths relative to a temporary directory. (Jonathan Lange) diff --git a/lib/fixtures/_fixtures/tempdir.py b/lib/fixtures/_fixtures/tempdir.py index b37a32b..663d3eb 100644 --- a/lib/fixtures/_fixtures/tempdir.py +++ b/lib/fixtures/_fixtures/tempdir.py @@ -44,7 +44,7 @@ class TempDir(fixtures.Fixture): self.path = tempfile.mkdtemp(dir=self.rootdir) self.addCleanup(shutil.rmtree, self.path, ignore_errors=True) - def abspath(self, *children): + def join(self, *children): """Return an absolute path, given one relative to this ``TempDir``. WARNING: This does not do any checking of ``children`` to make sure diff --git a/lib/fixtures/tests/_fixtures/test_tempdir.py b/lib/fixtures/tests/_fixtures/test_tempdir.py index cb0584e..d0def55 100644 --- a/lib/fixtures/tests/_fixtures/test_tempdir.py +++ b/lib/fixtures/tests/_fixtures/test_tempdir.py @@ -46,26 +46,26 @@ class TestTempDir(testtools.TestCase): with fixture: self.assertThat(fixture.path, StartsWith(root)) - def test_abspath(self): + def test_join(self): temp_dir = self.useFixture(TempDir()) root = temp_dir.path relpath = 'foo/bar/baz' self.assertEqual( - os.path.join(root, relpath), temp_dir.abspath(relpath)) + os.path.join(root, relpath), temp_dir.join(relpath)) - def test_abspath_multiple_children(self): + def test_join_multiple_children(self): temp_dir = self.useFixture(TempDir()) root = temp_dir.path self.assertEqual( os.path.join(root, 'foo', 'bar', 'baz'), - temp_dir.abspath('foo', 'bar', 'baz')) + temp_dir.join('foo', 'bar', 'baz')) - def test_abspath_naughty_children(self): + def test_join_naughty_children(self): temp_dir = self.useFixture(TempDir()) root = temp_dir.path self.assertEqual( os.path.abspath(os.path.join(root, '..', 'bar', 'baz')), - temp_dir.abspath('..', 'bar', 'baz')) + temp_dir.join('..', 'bar', 'baz')) class NestedTempfileTest(testtools.TestCase): |