Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Unified Diff: tools/tests/skimage_self_test.py

Issue 17101029: Treat empty directory properly in skimage. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Use README files to force directories to exist. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/tests/skimage/output-expected/nonexistent-dir/expectations.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/tests/skimage_self_test.py
diff --git a/tools/tests/skimage_self_test.py b/tools/tests/skimage_self_test.py
index cb66fe1729f51c6e10c40bbed482c72b3be5e32a..24164d4a5190b7bd397965127cedcab0e533ed3a 100755
--- a/tools/tests/skimage_self_test.py
+++ b/tools/tests/skimage_self_test.py
@@ -9,6 +9,7 @@ import filecmp
import os
import subprocess
import sys
+import tempfile
class BinaryNotFoundException(Exception):
def __str__ (self):
@@ -70,6 +71,26 @@ def main():
# TODO(scroggo): Add a test that compares expectations and image files that
# are known to NOT match, and make sure it returns an error.
+ # Generate an expectations file from an empty directory.
+ empty_dir = tempfile.mkdtemp()
+ expectations_path = os.path.join(file_dir, "skimage", "output-actual",
+ "empty-dir", "expectations.json")
+ subprocess.check_call([skimage_binary, "--readPath", empty_dir,
+ "--createExpectationsPath", expectations_path])
+ golden_expectations = os.path.join(file_dir, "skimage", "output-expected",
+ "empty-dir", "expectations.json")
+ DieIfFilesMismatch(expected=golden_expectations, actual=expectations_path)
+ os.rmdir(empty_dir)
+
+ # Generate an expectations file from a nonexistent directory.
+ expectations_path = os.path.join(file_dir, "skimage", "output-actual",
+ "nonexistent-dir", "expectations.json")
+ subprocess.check_call([skimage_binary, "--readPath", "/nonexistent/dir",
+ "--createExpectationsPath", expectations_path])
+ golden_expectations = os.path.join(file_dir, "skimage", "output-expected",
+ "nonexistent-dir", "expectations.json")
+ DieIfFilesMismatch(expected=golden_expectations, actual=expectations_path)
+
# Done with all tests.
print "Self tests succeeded!"
« no previous file with comments | « tools/tests/skimage/output-expected/nonexistent-dir/expectations.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698