Skip to content

Commit f302f5f

Browse files
committed
Fix a couple of test cases
By having a less disrupting change
1 parent 0c0e4cc commit f302f5f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

schema_salad/ref_resolver.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,6 @@ def expand_url(self,
249249
(splitbase.scheme, splitbase.netloc, pt, splitbase.query, frg))
250250
elif scoped_ref is not None and not split.fragment:
251251
pass
252-
elif base_url is None:
253-
url = pathlib.Path(os.path.join(os.getcwd(), url)).as_uri()
254252
else:
255253
url = self.fetcher.urljoin(base_url, url)
256254

@@ -381,6 +379,10 @@ def resolve_ref(self,
381379
inc = False
382380
mixin = None # type: Dict[unicode, Any]
383381

382+
if not base_url:
383+
ref = pathlib.Path(os.path.join(os.getcwd(), ref)).as_uri()
384+
base_url = pathlib.Path(os.getcwd()).as_uri() + '/'
385+
384386
sl = SourceLine(obj, None, ValueError)
385387
# If `ref` is a dict, look for special directives.
386388
if isinstance(ref, CommentedMap):
@@ -421,7 +423,6 @@ def resolve_ref(self,
421423
raise ValueError(u"Expected CommentedMap or string, got %s: `%s`" % (type(ref), unicode(ref)))
422424

423425
url = self.expand_url(ref, base_url, scoped_id=(obj is not None))
424-
base_url = base_url or pathlib.Path(os.getcwd()).as_uri() + '/'
425426
# Has this reference been loaded already?
426427
if url in self.idx and (not mixin):
427428
return self.idx[url], {}

0 commit comments

Comments
 (0)