Closed Bug 1043314 Opened 10 years ago Closed 10 years ago

Mozlog should enforce suite start before test_start or suite_end

Categories

(Testing :: Mozbase, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(firefox33 fixed, firefox34 fixed)

RESOLVED FIXED
mozilla34
Tracking Status
firefox33 --- fixed
firefox34 --- fixed

People

(Reporter: jgraham, Assigned: jgraham)

Details

Attachments

(1 file)

It also needs to ensure that the state used for enforcing these invariants is shared by all loggers of the same name.
Comment on attachment 8461449 [details] [diff] [review]
Enforce the invariant that we have suite_start before suite_end or test_start in mozlog

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

This looks good!

::: testing/mozbase/mozlog/mozlog/structured/structuredlog.py
@@ +94,3 @@
>  class StructuredLogger(object):
>      _lock = Lock()
> +    _shared_state = {}

_logger_states would be more descriptive.

@@ +192,5 @@
>  
>          :param test: Identifier of the test that will run.
>          """
> +        if not self._state.suite_started:
> +            self.error("Got second test_start message before suite_start for test %s" % test)

I don't think "second" is right here.

::: testing/mozbase/mozlog/tests/test_structured.py
@@ +28,5 @@
>  
>  class BaseStructuredTest(unittest.TestCase):
>      def setUp(self):
>          self.logger = structuredlog.StructuredLogger("test")
> +        print self.logger._state.suite_started

Debugging print?
Attachment #8461449 - Flags: review?(cmanchester) → review+
https://hg.mozilla.org/mozilla-central/rev/a4d20ab39b70
Assignee: nobody → james
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: