# Path: stestr/subunit_trace.py
# DAY_SECONDS = 60 * 60 * 24
# FAILS = []
# RESULTS = {}
# def total_seconds(timedelta):
# def cleanup_test_name(name, strip_tags=True, strip_scenarios=False):
# def get_duration(timestamps):
# def find_worker(test):
# def print_attachments(stream, test, all_channels=False,
#                       show_binary_attachments=False):
# def find_test_run_time_diff(test_id, run_time):
# def show_outcome(stream, test, print_failures=False, failonly=False,
#                  enable_diff=False, threshold='0', abbreviate=False,
#                  enable_color=False, suppress_attachments=False,
#                  all_attachments=False, show_binary_attachments=True):
# def print_fails(stream):
# def count_tests(key, value):
# def get_stuck_in_progress():
# def run_time():
# def worker_stats(worker):
# def print_summary(stream, elapsed_time):
# def parse_args():
# def trace(stdin, stdout, print_failures=False, failonly=False,
#           enable_diff=False, abbreviate=False, color=False, post_fails=False,
#           no_summary=False, suppress_attachments=False, all_attachments=False,
#           show_binary_attachments=False):
# def main():
# 
# Path: stestr/tests/base.py
# class TestCase(testtools.TestCase):
#     def setUp(self):


from datetime import datetime as dt
from unittest.mock import patch
from ddt import data
from ddt import ddt
from ddt import unpack
from subunit.iso8601 import UTC
from subunit.v2 import StreamResultToBytes
from stestr import subunit_trace
from stestr.tests import base
import io
import os
import sys
            dt(2015, 4, 17, 22, 23, 14, 111111)],
           "0.000000s"),
          ([dt(2015, 4, 17, 22, 23, 14, 111111),
            dt(2015, 4, 17, 22, 23, 15, 111111)],
           "1.000000s"),
          ([dt(2015, 4, 17, 22, 23, 14, 111111),
            None],
           ""))
    @unpack
    def test_get_durating(self, timestamps, expected_result):
        self.assertEqual(subunit_trace.get_duration(timestamps),
                         expected_result)

    @data(([dt(2015, 4, 17, 22, 23, 14, 111111),
            dt(2015, 4, 17, 22, 23, 14, 111111)],
           0.0),
          ([dt(2015, 4, 17, 22, 23, 14, 111111),
            dt(2015, 4, 17, 22, 23, 15, 111111)],
           1.0),
          ([dt(2015, 4, 17, 22, 23, 14, 111111),
            None],
           0.0))
    @unpack
    def test_run_time(self, timestamps, expected_result):
        patched_res = {
            0: [
                {'timestamps': timestamps}
            ]
        }
        with patch.dict(subunit_trace.RESULTS, patched_res, clear=True):

# Path: stestr/subunit_trace.py
# DAY_SECONDS = 60 * 60 * 24
# FAILS = []
# RESULTS = {}
# def total_seconds(timedelta):
# def cleanup_test_name(name, strip_tags=True, strip_scenarios=False):
# def get_duration(timestamps):
# def find_worker(test):
# def print_attachments(stream, test, all_channels=False,
#                       show_binary_attachments=False):
# def find_test_run_time_diff(test_id, run_time):
# def show_outcome(stream, test, print_failures=False, failonly=False,
#                  enable_diff=False, threshold='0', abbreviate=False,
#                  enable_color=False, suppress_attachments=False,
#                  all_attachments=False, show_binary_attachments=True):
# def print_fails(stream):
# def count_tests(key, value):
# def get_stuck_in_progress():
# def run_time():
# def worker_stats(worker):
# def print_summary(stream, elapsed_time):
# def parse_args():
# def trace(stdin, stdout, print_failures=False, failonly=False,
#           enable_diff=False, abbreviate=False, color=False, post_fails=False,
#           no_summary=False, suppress_attachments=False, all_attachments=False,
#           show_binary_attachments=False):
# def main():
# 
# Path: stestr/tests/base.py
# class TestCase(testtools.TestCase):
#     def setUp(self):


# Path: stestr/tests/test_subunit_trace.py
from datetime import datetime as dt
from unittest.mock import patch
from ddt import data
from ddt import ddt
from ddt import unpack
from subunit.iso8601 import UTC
from subunit.v2 import StreamResultToBytes
from stestr import subunit_trace
from stestr.tests import base
import io
import os
import sys

            dt(2015, 4, 17, 22, 23, 14, 111111)],
           "0.000000s"),
          ([dt(2015, 4, 17, 22, 23, 14, 111111),
            dt(2015, 4, 17, 22, 23, 15, 111111)],
           "1.000000s"),
          ([dt(2015, 4, 17, 22, 23, 14, 111111),
            None],
           ""))
    @unpack
    def test_get_durating(self, timestamps, expected_result):
        self.assertEqual(subunit_trace.get_duration(timestamps),
                         expected_result)

    @data(([dt(2015, 4, 17, 22, 23, 14, 111111),
            dt(2015, 4, 17, 22, 23, 14, 111111)],
           0.0),
          ([dt(2015, 4, 17, 22, 23, 14, 111111),
            dt(2015, 4, 17, 22, 23, 15, 111111)],
           1.0),
          ([dt(2015, 4, 17, 22, 23, 14, 111111),
            None],
           0.0))
    @unpack
    def test_run_time(self, timestamps, expected_result):
        patched_res = {
            0: [
                {'timestamps': timestamps}
            ]
        }
        with patch.dict(subunit_trace.RESULTS, patched_res, clear=True):

            self.assertEqual(subunit_trace.run_time(), expected_result)