File: test_code_blocks.py

package info (click to toggle)
pyroute2 0.8.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 3,700 kB
  • sloc: python: 50,245; makefile: 280; javascript: 183; ansic: 81; sh: 44; awk: 17
file content (26 lines) | stat: -rw-r--r-- 583 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os
import pathlib
import sys

import pytest


def get_examples(*argv):
    root = pathlib.Path(os.environ['WORKSPACE'])
    examples = [
        example
        for example in root.joinpath(*argv).iterdir()
        if example.is_dir()
    ]
    return {
        'argnames': 'example',
        'argvalues': examples,
        'ids': [x.name for x in examples],
    }


@pytest.mark.parametrize(**get_examples('examples', 'lab'))
def test_block(example, pytester):
    os.chdir(example.as_posix())
    result = pytester.run(sys.executable, 'check.py')
    assert result.ret == 0