Flutter Engine
The Flutter Engine
run_tests_test.py
Go to the documentation of this file.
1#!/usr/bin/env vpython3
2
3# [VPYTHON:BEGIN]
4# python_version: "3.8"
5# wheel <
6# name: "infra/python/wheels/pyyaml/${platform}_${py_python}_${py_abi}"
7# version: "version:5.4.1.chromium.1"
8# >
9# [VPYTHON:END]
10
11# Copyright 2013 The Flutter Authors. All rights reserved.
12# Use of this source code is governed by a BSD-style license that can be
13# found in the LICENSE file.
14
15import os
16import shutil
17import unittest
18
19from pathlib import Path
20
21# pylint is looking for a wrong //testing/run_tests.py.
22# pylint: disable=no-member
23import run_tests
24
25run_tests.OUT_DIR = '/tmp/out/fuchsia_debug_x64'
26os.makedirs(run_tests.OUT_DIR, exist_ok=True)
27
28
29class RunTestsTest(unittest.TestCase):
30
32 packages = run_tests.resolve_packages([{'package': 'abc'}, {'packages': ['abc', 'def']}])
33 self.assertEqual(
34 packages, {os.path.join(run_tests.OUT_DIR, 'abc'),
35 os.path.join(run_tests.OUT_DIR, 'def')}
36 )
37
39 Path(os.path.join(run_tests.OUT_DIR, 'abc-0.far')).touch()
41 {'package': 'abc-0.far'},
42 ])
43 self.assertEqual(packages, {os.path.join(run_tests.OUT_DIR, 'abc.far')})
44 self.assertTrue(os.path.islink(os.path.join(run_tests.OUT_DIR, 'abc.far')))
45
47 test_cases = run_tests.build_test_cases([
48 {'test_command': 'test run abc'},
49 {'test_command': 'test run def -- --args'},
50 ])
51 self.assertEqual(
52 test_cases,
53 [run_tests.TestCase(package='abc'),
54 run_tests.TestCase(package='def', args='--args')]
55 )
56
57
58if __name__ == '__main__':
59 try:
60 unittest.main()
61 finally:
62 # Clean up the temporary files. Since it's in /tmp/, ignore the errors.
63 shutil.rmtree(run_tests.OUT_DIR, ignore_errors=True)
def test_resolve_package_make_symbolic_link(self)
def test_build_test_cases_with_arguments(self)
def test_resolve_both_package_and_packages(self)
CanvasPath Path
Definition: dart_ui.cc:58
Set[str] resolve_packages(Iterable[Mapping[str, Any]] tests)
Definition: run_tests.py:82
List[TestCase] build_test_cases(Iterable[Mapping[str, Any]] tests)
Definition: run_tests.py:111