• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pybuilder / pybuilder / 16613314016

30 Jul 2025 04:14AM UTC coverage: 84.008% (-0.1%) from 84.146%
16613314016

push

github

arcivanov
Release 0.13.16

2167 of 2671 branches covered (81.13%)

Branch coverage included in aggregate %.

5534 of 6496 relevant lines covered (85.19%)

36.25 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

51.56
/src/main/python/pybuilder/plugins/exec_plugin.py
1
#   -*- coding: utf-8 -*-
2
#
3
#   This file is part of PyBuilder
4
#
5
#   Copyright 2011-2020 PyBuilder Team
6
#
7
#   Licensed under the Apache License, Version 2.0 (the "License");
8
#   you may not use this file except in compliance with the License.
9
#   You may obtain a copy of the License at
10
#
11
#       http://www.apache.org/licenses/LICENSE-2.0
12
#
13
#   Unless required by applicable law or agreed to in writing, software
14
#   distributed under the License is distributed on an "AS IS" BASIS,
15
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
#   See the License for the specific language governing permissions and
17
#   limitations under the License.
18

19
import sys
44✔
20
from subprocess import PIPE, Popen
44✔
21

22
from pybuilder.core import task, use_plugin
44✔
23
from pybuilder.errors import BuildFailedException
44✔
24

25
use_plugin("core")
44✔
26

27

28
@task
44✔
29
def run_unit_tests(project, logger):
44✔
30
    run_command('run_unit_tests', project, logger)
44✔
31

32

33
@task
44✔
34
def run_integration_tests(project, logger):
44✔
35
    run_command('run_integration_tests', project, logger)
44✔
36

37

38
@task
44✔
39
def analyze(project, logger):
44✔
40
    run_command('analyze', project, logger)
44✔
41

42

43
@task
44✔
44
def package(project, logger):
44✔
45
    run_command('package', project, logger)
44✔
46

47

48
@task
44✔
49
def publish(project, logger):
44✔
50
    run_command('publish', project, logger)
44✔
51

52

53
def _write_command_report(project, stdout, stderr, command_line, phase, process_return_code):
44✔
54
    project.write_report('exec_%s' % phase, stdout)
×
55
    project.write_report('exec_%s.err' % phase, stderr)
×
56

57

58
def _log_quoted_output(logger, output_type, output, phase):
44✔
59
    separator = '-' * 5
×
60
    logger.info('{0} verbatim {1} output of {2} {0}'.format(separator, output_type, phase))
×
61
    for line in output.split('\n'):
×
62
        logger.info(line)
×
63
    logger.info('{0} end of verbatim {1} output {0}'.format(separator, output_type))
×
64

65

66
def run_command(phase, project, logger):
44✔
67
    command_line = project.get_property('%s_command' % phase)
×
68

69
    if not command_line:
×
70
        return
×
71

72
    process_handle = Popen(command_line, stdout=PIPE, stderr=PIPE, shell=True)
×
73
    stdout, stderr = process_handle.communicate()
×
74
    stdout, stderr = stdout.decode(sys.stdout.encoding or 'utf-8'), stderr.decode(sys.stderr.encoding or 'utf-8')
×
75
    process_return_code = process_handle.returncode
×
76

77
    _write_command_report(project,
×
78
                          stdout,
79
                          stderr,
80
                          command_line,
81
                          phase,
82
                          process_return_code)
83

84
    if project.get_property('%s_propagate_stdout' % phase) and stdout:
×
85
        _log_quoted_output(logger, '', stdout, phase)
×
86

87
    if project.get_property('%s_propagate_stderr' % phase) and stderr:
×
88
        _log_quoted_output(logger, 'error', stderr, phase)
×
89

90
    if process_return_code != 0:
×
91
        raise BuildFailedException(
×
92
            'exec plugin command {0} for {1} exited with nonzero code {2}'.format(command_line,
93
                                                                                  phase,
94
                                                                                  process_return_code))
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc