Skip to content

Commit 83266c5

Browse files
authored
Merge pull request #89 from Cadair/fix_cli_https
Fix passing a https url for baseline via the CLI
2 parents b0783eb + a1d4f66 commit 83266c5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pytest_mpl/plugin.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ def _download_file(baseline, filename):
6363
try:
6464
u = urlopen(base_url + filename)
6565
content = u.read()
66-
except Exception:
67-
warnings.warn('Downloading {0} failed'.format(base_url + filename))
66+
except Exception as e:
67+
warnings.warn('Downloading {0} failed: {1}'.format(base_url + filename, e))
6868
else:
6969
break
7070
else:
@@ -124,7 +124,7 @@ def pytest_configure(config):
124124
if results_dir is not None and generate_dir is not None:
125125
warnings.warn("Ignoring --mpl-result-path since --mpl-generate-path is set")
126126

127-
if baseline_dir is not None:
127+
if baseline_dir is not None and not baseline_dir.startswith(("https", "http")):
128128
baseline_dir = os.path.abspath(baseline_dir)
129129
if generate_dir is not None:
130130
baseline_dir = os.path.abspath(generate_dir)
@@ -227,10 +227,10 @@ def item_function_wrapper(*args, **kwargs):
227227
else:
228228
baseline_dir = self.baseline_dir
229229
baseline_remote = False
230-
else:
231-
baseline_remote = baseline_dir.startswith(('http://', 'https://'))
232-
if not baseline_remote:
233-
baseline_dir = os.path.join(os.path.dirname(item.fspath.strpath), baseline_dir)
230+
231+
baseline_remote = baseline_dir.startswith(('http://', 'https://'))
232+
if not baseline_remote:
233+
baseline_dir = os.path.join(os.path.dirname(item.fspath.strpath), baseline_dir)
234234

235235
with plt.style.context(style, after_reset=True), switch_backend(backend):
236236

0 commit comments

Comments
 (0)