File: rm_workspace_coverage.py

package info (click to toggle)
python-django-treebeard 4.3.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,160 kB
  • sloc: python: 5,010; makefile: 184
file content (23 lines) | stat: -rw-r--r-- 581 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
"""Remove `.coverage.$HOST.$ID` files from previous runs.

In Python because of portability with Windows.
"""

import sys

import os
import os.path


def main():
    workspace = os.environ['WORKSPACE']
    for filename in os.listdir(os.path.join(workspace, ".tests")):
        if filename.startswith('coverage.'):
            file_full_name = os.path.join(workspace, filename)
            sys.stdout.write(
                '* Removing old .coverage file: `%s`\n' % file_full_name)
            os.unlink(file_full_name)
    sys.stdout.flush()

if __name__ == '__main__':
    main()