Esempio n. 1
0
    def _get_test_metadata(self):
        f = NamedTemporaryFile()
        f.write(ALL_TESTS_JSON)
        f.flush()
        self._temp_files.append(f)

        return TestMetadata(filename=f.name)
Esempio n. 2
0
    def _get_test_metadata(self):
        f = NamedTemporaryFile()
        f.write(ALL_TESTS_JSON)
        f.flush()
        self._temp_files.append(f)

        return TestMetadata(filename=f.name)
Esempio n. 3
0
class TestLineEndings(unittest.TestCase):
    """
    Unit tests for the Context class
    """
    def setUp(self):
        self.pp = Preprocessor()
        self.pp.out = StringIO()
        self.f = NamedTemporaryFile(mode='wb')

    def tearDown(self):
        self.f.close()

    def createFile(self, lineendings):
        for line, ending in zip([b'a', b'#literal b', b'c'], lineendings):
            self.f.write(line + ending)
        self.f.flush()

    def testMac(self):
        self.createFile([b'\x0D'] * 3)
        self.pp.do_include(self.f.name)
        self.assertEquals(self.pp.out.getvalue(), 'a\nb\nc\n')

    def testUnix(self):
        self.createFile([b'\x0A'] * 3)
        self.pp.do_include(self.f.name)
        self.assertEquals(self.pp.out.getvalue(), 'a\nb\nc\n')

    def testWindows(self):
        self.createFile([b'\x0D\x0A'] * 3)
        self.pp.do_include(self.f.name)
        self.assertEquals(self.pp.out.getvalue(), 'a\nb\nc\n')
    def _get_test_metadata(self):
        all_tests = NamedTemporaryFile(mode='wb')
        pickle.dump(ALL_TESTS, all_tests)
        all_tests.flush()
        self._temp_files.append(all_tests)

        test_defaults = NamedTemporaryFile(mode='wb')
        pickle.dump(TEST_DEFAULTS, test_defaults)
        test_defaults.flush()
        self._temp_files.append(test_defaults)

        return TestMetadata(all_tests.name, test_defaults=test_defaults.name)
Esempio n. 5
0
    def _get_test_metadata(self):
        all_tests = NamedTemporaryFile(mode='wb')
        pickle.dump(ALL_TESTS, all_tests)
        all_tests.flush()
        self._temp_files.append(all_tests)

        test_defaults = NamedTemporaryFile(mode='wb')
        pickle.dump(TEST_DEFAULTS, test_defaults)
        test_defaults.flush()
        self._temp_files.append(test_defaults)

        return TestMetadata(all_tests.name, test_defaults=test_defaults.name)
Esempio n. 6
0
    def _get_test_metadata(self):
        all_tests = NamedTemporaryFile(mode='wb')
        pickle.dump(ALL_TESTS, all_tests)
        all_tests.flush()
        self._temp_files.append(all_tests)

        test_defaults = NamedTemporaryFile(mode='wb')
        pickle.dump(TEST_DEFAULTS, test_defaults)
        test_defaults.flush()
        self._temp_files.append(test_defaults)

        rv = TestMetadata(all_tests.name, "/firefox/", test_defaults=test_defaults.name)
        rv._wpt_loaded = True  # Don't try to load the wpt manifest
        return rv