def test_file_parse(self):
        # write VARS_FILE into a file that gets cleaned up, then test parsing it
        with temp_file() as filename:
            f = open(filename, 'w')
            f.write(VARS_FILE)
            f.close()

            result = BStrapVars.factory_from_sass_file(filename)
            result_json = result.base_to_json()
            self.assertEqual(VARS_JSON, result_json)

        # test error handling properly ignores bad variables
        with temp_file() as filename:
            f = open(filename, 'w')
            f.write(ERROR_VARS_FILE)
            f.close()

            result = BStrapVars.factory_from_sass_file(filename)
            result_json = result.base_to_json()
            self.assertEqual(ERROR_VARS_JSON, result_json)
    def test_file_parse(self):
        # write VARS_FILE into a file that gets cleaned up, then test parsing it
        with temp_file() as filename:
            f = open(filename, 'w')
            f.write(VARS_FILE)
            f.close()

            result = BStrapVars.factory_from_sass_file(filename)
            result_json = result.base_to_json()
            self.assertEqual(VARS_JSON, result_json)

        # test error handling properly ignores bad variables
        with temp_file() as filename:
            f = open(filename, 'w')
            f.write(ERROR_VARS_FILE)
            f.close()

            result = BStrapVars.factory_from_sass_file(filename)
            result_json = result.base_to_json()
            self.assertEqual(ERROR_VARS_JSON, result_json)
    def test_module_main(self):
        # write VARS_FILE into a file that gets cleaned up 
        with capture_stdout(), temp_file() as filename:
            f = open(filename, 'w')
            f.write(VARS_FILE)
            f.close()

            import sys
            keep = sys.argv
            try:
                sys.argv[1] = filename
            except IndexError:
                sys.argv.append(filename)

            runpy.run_module('bseditor.conv', run_name='__main__')
            sys.argv = keep
    def test_module_main(self):
        # write VARS_FILE into a file that gets cleaned up
        with capture_stdout(), temp_file() as filename:
            f = open(filename, 'w')
            f.write(VARS_FILE)
            f.close()

            import sys
            keep = sys.argv
            try:
                sys.argv[1] = filename
            except IndexError:
                sys.argv.append(filename)

            runpy.run_module('bseditor.conv', run_name='__main__')
            sys.argv = keep
Exemple #5
0
    def test_temp_file(self):
        with temp_file() as filename:
            self.assertTrue(os.path.exists(filename))

        self.assertFalse(os.path.exists(filename))
Exemple #6
0
    def test_temp_file(self):
        with temp_file() as filename:
            self.assertTrue(os.path.exists(filename))

        self.assertFalse(os.path.exists(filename))