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

msiemens / PyGitUp / 11756390499

07 Oct 2024 05:25PM UTC coverage: 93.284%. Remained the same
11756390499

push

github

web-flow
infra: update pytest to v8 (#135)

* Tested with Python 3.12

* Upgrade pytest to the latest version 8.3.3

* Rename setup/teardown functions

Old names were there for compatibility with nose and they're no longer supported in pytest 8.

---------

Co-authored-by: Markus Siemens <markus@m-siemens.de>

375 of 402 relevant lines covered (93.28%)

16.45 hits per line

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

90.91
/PyGitUp/utils.py
1
"""
2
Some simple, generic useful methods.
3
"""
4
import subprocess
18✔
5
import sys
18✔
6

7
from subprocess import DEVNULL
18✔
8

9

10
def find(seq, test):
18✔
11
    """ Return first item in sequence where test(item) == True """
12
    for item in seq:
18✔
13
        if test(item):
18✔
14
            return item
18✔
15

16

17
def uniq(seq):
18✔
18
    """ Return a copy of seq without duplicates. """
19
    seen = set()
18✔
20
    return [x for x in seq if str(x) not in seen and not seen.add(str(x))]
18✔
21

22

23
def execute(cmd, cwd=None):
18✔
24
    """ Execute a command and return it's output. """
25
    try:
18✔
26
        lines = subprocess \
18✔
27
            .check_output(cmd, cwd=cwd, stderr=DEVNULL) \
28
            .splitlines()
29
    except subprocess.CalledProcessError:
18✔
30
        return None
18✔
31
    else:
32
        if lines:
18✔
33
            return decode(lines[0].strip())
18✔
34
        else:
35
            return None
×
36

37

38
def decode(s):
18✔
39
    """
40
    Decode a string using the system encoding if needed (ie byte strings)
41
    """
42
    if isinstance(s, bytes):
18✔
43
        return s.decode(sys.getdefaultencoding())
18✔
44
    else:
45
        return s
×
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