'If no working directory is explicitly specified and the default
working directory is in use by another runner, L{TrialRunner.run}
selects a different default working directory to use.'

def test_concurrentImplicitWorkingDirectory(self):

    self.parseOptions([])
    self.addCleanup(os.chdir, os.getcwd())
    runDirectory = FilePath(self.mktemp())
    runDirectory.makedirs()
    os.chdir(runDirectory.path)
    firstRunner = self.getRunner()
    secondRunner = self.getRunner()
    where = {}
    class ConcurrentCase(unittest.SynchronousTestCase, ):
        def test_first(self):
            '\n                                                                Start    a    second    test    run    which    will    have    a    default    working\n                                                                directory    which    is    the    same    as    the    working    directory    of    the\n                                                                test    run    already    in    progress.\n                                                                '
            where['concurrent'] = subsequentDirectory = os.getcwd()
            os.chdir(runDirectory.path)
            self.addCleanup(os.chdir, subsequentDirectory)
            secondRunner.run(ConcurrentCase('test_second'))
        def test_second(self):
            '\n                                                                Record    the    working    directory    for    later    analysis.\n                                                                '
            where['record'] = os.getcwd()
    result = firstRunner.run(ConcurrentCase('test_first'))
    bad = (result.errors + result.failures)
    if bad:
        self.fail(bad[0][1])
    self.assertEqual(where, {'concurrent': runDirectory.child('_trial_temp').path, 'record': runDirectory.child('_trial_temp-1').path})
