-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
assertSameFiles of perceptualdiff engine fails when file paths contain spaces #43
Comments
Hmmm, that entire line should really just be a list so subprocess will handle escaping for us. |
Thanks for the report. @sterago, could you confirm if this patch below would fix your issue? diff --git a/needle/engines/perceptualdiff_engine.py b/needle/engines/perceptualdiff_engine.py
index 33ef157..bdf1777 100644
--- a/needle/engines/perceptualdiff_engine.py
+++ b/needle/engines/perceptualdiff_engine.py
@@ -17,8 +17,7 @@ class Engine(EngineBase):
threshold = int(width * height * threshold)
diff_ppm = output_file.replace(".png", ".diff.ppm")
- cmd = "%s -threshold %d -output %s %s %s" % (
- self.perceptualdiff_path, threshold, diff_ppm, baseline_file, output_file)
+ cmd = [self.perceptualdiff_path, '-threshold', threshold, '-output', diff_ppm, baseline_file, output_file]
process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
perceptualdiff_stdout, _ = process.communicate() |
hi @jphalip and thanks for the patch.
other than that, it works fine hope this helps |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First of all, thanks for the nice tool!
We are using it in a Jenkins CI setup, and the screenshots path happens to have spaces.
This is causing the perceptualdiff command to parse the --output parameter incorrectly, splitting it in correspondence of the space.
We've now worked around the issue by patching this line:
https://github.com/bfirsh/needle/blob/master/needle/engines/perceptualdiff_engine.py#L20
specifically replacing
with
The text was updated successfully, but these errors were encountered: