Completed
Pull Request — master (#157)
by
unknown
10:43 queued 10:03
created

run_test_command()   A

Complexity

Conditions 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 4.048

Importance

Changes 0
Metric Value
cc 2
dl 0
loc 5
ccs 1
cts 5
cp 0.2
crap 4.048
rs 9.4285
c 0
b 0
f 0
1 3
import logging
2
3 3
from plumbum import local, CommandNotFound
0 ignored issues
show
Configuration introduced by
The import plumbum could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
4
5 3
from changes import shell
6
7 3
log = logging.getLogger(__name__)
0 ignored issues
show
Coding Style Naming introduced by
The name log does not conform to the constant naming conventions ((([A-Z_][A-Z0-9_]*)|(__.*__))$).

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
8
9
10 3
def get_test_runner():
11
    test_runners = ['tox', 'nosetests', 'py.test']
12
    test_runner = None
13
    for runner in test_runners:
14
        try:
15
            test_runner = local[runner]
16
        except CommandNotFound:
17
            continue
18
    return test_runner
19
20
21 3
def run_tests():
22
    """Executes your tests."""
23
    test_runner = get_test_runner()
24
    if test_runner:
25
        result = test_runner()
26
        log.info('Test execution returned:\n%s' % result)
27
        return result
28
    else:
29
        log.info('No test runner found')
30
31
    return None
32
33
34 3
def run_test_command(context):
35
    if context.test_command:
36
        result = shell.dry_run(context.test_command, context.dry_run)
37
        log.info('Test command "%s", returned %s', context.test_command, result)
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (80/79).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
38
    return True
39