Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: README.md

Issue 1014323004: Updated documentation for expect_tests. (Closed) Base URL: https://chromium.googlesource.com/infra/testing/expect_tests.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Expect Tests 1 # Expect Tests
2 Expect Tests is a test framework which: 2 Expect Tests is a test framework which:
3 * Is parallel by default 3 * Is parallel by default
4 * Collects coverage information by default 4 * Collects coverage information by default
5 * Allows easy test-case generation 5 * Allows easy test-case generation
6 * Is compatible with unittest 6 * Is compatible with unittest
7 * Provides easy test globbing and debugging 7 * Provides easy test globbing and debugging
8 8
9 You can run the test suite with 'nosetests expect_tests/test' in the root 9 You can run the test suite with 'nosetests expect_tests/test' in the root
10 directory. 10 directory.
11 11
12 ## Quick user manual 12 ## Quick user manual
13 13
14 ### Writing tests 14 ### Writing tests
15 Tests are subclasses of unittests.TestCase only. expect_tests looks for tests in 15 Tests are subclasses of unittests.TestCase only. expect_tests looks for tests in
16 files named like '*\_test.py'. The coverage information for file foo.py is only 16 files named like '*\_test.py'. The coverage information for file foo.py is only
17 collected from tests located in 'tests/foo\_test.py'. 17 collected from tests located in 'test/foo\_test.py'.
18 18
19 ### Invocation 19 ### Invocation
20 The simplest expect_tests invocation is: 20 The simplest expect_tests invocation is:
21 21
22 expect_tests (list|test|train) <path> 22 expect_tests (list|test|train) <path>
23 23
24 where <path> can point either to a Python (sub)package's directory, or to a 24 where <path> can point either to a Python (sub)package's directory, or to a
25 directory containing Python packages. In the latter case, all tests in all 25 directory containing Python packages. In the latter case, all tests in all
26 packages in the directory will be considered. 26 packages in the directory will be considered.
27 27
(...skipping 10 matching lines...) Expand all
38 38
39 <filter glob> applies to the full test names, as output by 'list'. It does not 39 <filter glob> applies to the full test names, as output by 'list'. It does not
40 apply to the package path. 40 apply to the package path.
41 41
42 Example: Suppose you have the following structure: 42 Example: Suppose you have the following structure:
43 43
44 root/ 44 root/
45 root/package1 45 root/package1
46 root/package1/__init__.py 46 root/package1/__init__.py
47 root/package1/foo.py 47 root/package1/foo.py
48 root/package1/tests/__init__.py 48 root/package1/test/__init__.py
49 root/package1/tests/foo_test.py # contains test TestFoo.test\_feature 49 root/package1/test/foo_test.py # contains test TestFoo.test\_feature
50 root/package1/subpackage 50 root/package1/subpackage
51 root/package1/subpackage/__init__.py 51 root/package1/subpackage/__init__.py
52 root/package1/subpackage/subfoo.py 52 root/package1/subpackage/subfoo.py
53 root/package1/subpackage/tests/__init__.py 53 root/package1/subpackage/test/__init__.py
54 root/package1/subpackage/tests/subfoo_test.py # contains TestSubFoo.test\_f eature 54 root/package1/subpackage/test/subfoo_test.py # contains TestSubFoo.test\_fe ature
55 root/package2/... # with same structure as package1 55 root/package2/... # with same structure as package1
56 56
57 Then (supposing the current directory is the parent of 'root/') 57 Then (supposing the current directory is the parent of 'root/')
58 58
59 $ expect_tests list root 59 $ expect_tests list root
60 package1.tests.foo_test.TestFoo.test_feature 60 package1.tests.foo_test.TestFoo.test_feature
61 package1.subpackage.tests.subfoo_test.TestSubFoo.test_feature 61 package1.subpackage.tests.subfoo_test.TestSubFoo.test_feature
62 package2.tests.foo_test.TestFoo.test_feature 62 package2.tests.foo_test.TestFoo.test_feature
63 package2.subpackage.tests.subfoo_test.TestSubFoo.test_feature 63 package2.subpackage.tests.subfoo_test.TestSubFoo.test_feature
64 64
(...skipping 20 matching lines...) Expand all
85 85
86 [expect_tests] 86 [expect_tests]
87 skip=packagetoignore1 87 skip=packagetoignore1
88 packagetoignore2 88 packagetoignore2
89 89
90 Some Python code, like the Appengine sdk, requires some special setup to be able 90 Some Python code, like the Appengine sdk, requires some special setup to be able
91 to work. In order to support that, you can create a .expect\_tests\_pretest.py 91 to work. In order to support that, you can create a .expect\_tests\_pretest.py
92 file in the directory containing the top-level package containing tests. This 92 file in the directory containing the top-level package containing tests. This
93 code will be execfile'd just before any operation (list/run/train) in this 93 code will be execfile'd just before any operation (list/run/train) in this
94 directory. 94 directory.
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698