|
7 | 7 | # We need to grab one text example from hypothesis to prime its cache. |
8 | 8 | text().example() |
9 | 9 |
|
10 | | -# This pair of generator expressions are pretty lame, but building lists is a |
11 | | -# bad idea as I plan to have a substantial number of tests here. |
12 | | -story_directories = ( |
13 | | - os.path.join('tests/test_fixtures', d) |
14 | | - for d in os.listdir('tests/test_fixtures') |
15 | | -) |
16 | | -story_files = ( |
17 | | - os.path.join(storydir, name) |
18 | | - for storydir in story_directories |
19 | | - for name in os.listdir(storydir) |
20 | | - if 'raw-data' not in storydir |
21 | | -) |
22 | | -raw_story_files = ( |
23 | | - os.path.join('tests/test_fixtures/raw-data', name) |
24 | | - for name in os.listdir('tests/test_fixtures/raw-data') |
25 | | -) |
26 | | - |
27 | | - |
28 | | -@pytest.fixture(scope='class', params=story_files) |
29 | | -def story(request): |
30 | | - """ |
31 | | - Provides a detailed HPACK story to test with. |
32 | | - """ |
33 | | - with open(request.param, 'r', encoding='utf-8') as f: |
34 | | - return json.load(f) |
35 | | - |
36 | | - |
37 | | -@pytest.fixture(scope='class', params=raw_story_files) |
38 | | -def raw_story(request): |
39 | | - """ |
40 | | - Provides a detailed HPACK story to test the encoder with. |
41 | | - """ |
42 | | - with open(request.param, 'r', encoding='utf-8') as f: |
43 | | - return json.load(f) |
| 10 | +if os.path.isdir('tests/test_fixtures/'): |
| 11 | + # large integration tests are not shipped in sdist. |
| 12 | + # see https://github.com/python-hyper/hpack/commit/09dcf5a695266c35ff594605e79f472f224e7b7f |
| 13 | + # see https://github.com/python-hyper/hpack/issues/272 |
| 14 | + |
| 15 | + # This pair of generator expressions are pretty lame, but building lists is a |
| 16 | + # bad idea as I plan to have a substantial number of tests here. |
| 17 | + story_directories = ( |
| 18 | + os.path.join('tests/test_fixtures', d) |
| 19 | + for d in os.listdir('tests/test_fixtures') |
| 20 | + ) |
| 21 | + story_files = ( |
| 22 | + os.path.join(storydir, name) |
| 23 | + for storydir in story_directories |
| 24 | + for name in os.listdir(storydir) |
| 25 | + if 'raw-data' not in storydir |
| 26 | + ) |
| 27 | + raw_story_files = ( |
| 28 | + os.path.join('tests/test_fixtures/raw-data', name) |
| 29 | + for name in os.listdir('tests/test_fixtures/raw-data') |
| 30 | + ) |
| 31 | + |
| 32 | + |
| 33 | + @pytest.fixture(scope='class', params=story_files) |
| 34 | + def story(request): |
| 35 | + """ |
| 36 | + Provides a detailed HPACK story to test with. |
| 37 | + """ |
| 38 | + with open(request.param, 'r', encoding='utf-8') as f: |
| 39 | + return json.load(f) |
| 40 | + |
| 41 | + |
| 42 | + @pytest.fixture(scope='class', params=raw_story_files) |
| 43 | + def raw_story(request): |
| 44 | + """ |
| 45 | + Provides a detailed HPACK story to test the encoder with. |
| 46 | + """ |
| 47 | + with open(request.param, 'r', encoding='utf-8') as f: |
| 48 | + return json.load(f) |
0 commit comments