Closed Bug 951153 Opened 6 years ago Closed 6 years ago

Unclear error message if manifest has a non-existent file

Categories

(Testing :: Marionette, defect)

defect
Not set

Tracking

(b2g-v1.3 fixed)

RESOLVED FIXED
mozilla29
Tracking Status
b2g-v1.3 --- fixed

People

(Reporter: mdas, Assigned: mdas)

Details

Attachments

(1 file, 1 obsolete file)

We get a stacktrace that looks like the following if there's a file that doesn't exist listed in the test manifest:
Traceback (most recent call last):
  File "runtests.py", line 33, in <module>
    cli()
  File "runtests.py", line 28, in cli
    runner = startTestRunner(runner_class, options, tests)
  File "runtests.py", line 19, in startTestRunner
    runner.run_tests(tests)
  File "/Users/mdas/Code/m-c/testing/marionette/client/marionette/runner/base.py", line 715, in run_tests
    self.run_test(test)
  File "/Users/mdas/Code/m-c/testing/marionette/client/marionette/runner/base.py", line 816, in run_test
    self.run_test(i["path"], i["expected"])
  File "/Users/mdas/Code/m-c/testing/marionette/client/marionette/runner/base.py", line 833, in run_test
    **self.test_kwargs)
  File "/Users/mdas/Code/m-c/testing/marionette/client/marionette/marionette_test.py", line 297, in add_tests_to_suite
    test_mod = imp.load_source(mod_name, filepath)
IOError: [Errno 2] No such file or directory

Which is pretty much unhelpful. We should output the name of the test that we can't find.
Attached patch output test path (obsolete) — Splinter Review
Attachment #8348751 - Flags: review?(jgriffin)
Comment on attachment 8348751 [details] [diff] [review]
output test path

Review of attachment 8348751 [details] [diff] [review]:
-----------------------------------------------------------------

::: testing/marionette/client/marionette/runner/base.py
@@ +813,5 @@
>              if self.shuffle:
>                  random.shuffle(target_tests)
>              for i in target_tests:
> +                if not os.path.exists(i["path"]):
> +                    raise Exception("test file: %s does not exist" % i["path"])

Why not raising an IOError? I feel the Exception type is a bit too general.
Agreed, I've also changed the other file existence exception to an IOError
Attachment #8348751 - Attachment is obsolete: true
Attachment #8348751 - Flags: review?(jgriffin)
Attachment #8348768 - Flags: review?(jgriffin)
Comment on attachment 8348768 [details] [diff] [review]
output test path and throw IOError when appropriate

Review of attachment 8348768 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks.
Attachment #8348768 - Flags: review?(jgriffin) → review+
https://hg.mozilla.org/mozilla-central/rev/7da640f24355
Assignee: nobody → mdas
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in before you can comment on or make changes to this bug.