Skip to content

Commit

Permalink
directory dependency - resolve relative paths
Browse files Browse the repository at this point in the history
  • Loading branch information
kapilt committed Feb 15, 2020
1 parent ed44342 commit 485d983
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions poetry/packages/directory_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def __init__(
if self._base and not self._path.is_absolute():
self._full_path = self._base / self._path

self._full_path = self._full_path.resolve()

if not self._full_path.exists():
raise ValueError("Directory {} does not exist".format(self._path))

Expand Down
10 changes: 10 additions & 0 deletions tests/packages/test_directory_dependency.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from subprocess import CalledProcessError

import pytest
Expand All @@ -19,3 +20,12 @@ def run(self, bin, *args):
def test_directory_dependency_must_exist():
with pytest.raises(ValueError):
DirectoryDependency("demo", DIST_PATH / "invalid")


def test_directory_relative_path():
assert DirectoryDependency(
'demo', Path(
os.path.sep.join([
str(Path(__file__).parent),
'..', 'fixtures', 'git', 'github.com', 'demo', 'demo']))
).full_path == DIST_PATH / 'demo'

0 comments on commit 485d983

Please sign in to comment.