瀏覽代碼

Fix tests

Kentaro Wada 5 年之前
父節點
當前提交
099e347a42

+ 3 - 3
docs/man/labelme.1

@@ -1,7 +1,7 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.47.8.
-.TH LABELME "1" "July 2019" "labelme 3.16.1" "User Commands"
+.TH LABELME "1" "July 2019" "labelme 3.16.2" "User Commands"
 .SH NAME
-labelme \- manual page for labelme 3.16.1
+labelme \- manual page for labelme 3.16.2
 .SH DESCRIPTION
 usage: labelme [\-h] [\-\-version] [\-\-reset\-config]
 .IP
@@ -35,7 +35,7 @@ output file or directory (if it ends with .json it is
 recognized as file, else as directory)
 .TP
 \fB\-\-config\fR CONFIG_FILE
-config file (default: /Users/wkentaro/.labelmerc)
+config file (default: /home/wkentaro/.labelmerc)
 .TP
 \fB\-\-nodata\fR
 stop storing image data to JSON file

+ 11 - 5
tests/docs_tests/man_tests/test_labelme_1.py

@@ -14,7 +14,8 @@ here = osp.dirname(osp.abspath(__file__))
 cmd = 'help2man labelme'
 man_expected = subprocess.check_output(shlex.split(cmd)).decode().splitlines()
 
-with open(osp.join(here, '../../../docs/man/labelme.1')) as f:
+man_file = osp.realpath(osp.join(here, '../../../docs/man/labelme.1'))
+with open(man_file) as f:
     man_actual = f.read().splitlines()
 
 patterns_exclude = [
@@ -22,7 +23,7 @@ patterns_exclude = [
     r'^config file.*',
 ]
 
-FAIL = 0
+PASS = 1
 for line_expected, line_actual in zip(man_expected, man_actual):
     for pattern in patterns_exclude:
         if re.match(pattern, line_expected) or re.match(pattern, line_actual):
@@ -31,6 +32,11 @@ for line_expected, line_actual in zip(man_expected, man_actual):
         if line_expected != line_actual:
             print(repr('> {}'.format(line_expected)), file=sys.stderr)
             print(repr('< {}'.format(line_actual)), file=sys.stderr)
-            FAIL = 1
-
-sys.exit(FAIL)
+            PASS = 0
+
+if not PASS:
+    print(
+        'Please run:\n\n\thelp2man labelme > {}\n'.format(man_file),
+        file=sys.stderr,
+    )
+assert PASS

+ 1 - 1
tests/labelme_tests/data/apc2016_obj3.jpg

@@ -1 +1 @@
-../../examples/tutorial/apc2016_obj3.jpg
+../../../examples/tutorial/apc2016_obj3.jpg

+ 1 - 1
tests/labelme_tests/data/apc2016_obj3.json

@@ -1 +1 @@
-../../examples/tutorial/apc2016_obj3.json
+../../../examples/tutorial/apc2016_obj3.json