File tree Expand file tree Collapse file tree 3 files changed +23
-16
lines changed Expand file tree Collapse file tree 3 files changed +23
-16
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -52,10 +52,10 @@ jobs:
52
52
include :
53
53
- os : ubuntu-latest
54
54
noxenv : " tests-3.11(format)"
55
- posargs : ghcoverage
55
+ posargs : coverage github
56
56
- os : ubuntu-latest
57
57
noxenv : " tests-3.11(no-extras)"
58
- posargs : ghcoverage
58
+ posargs : coverage github
59
59
exclude :
60
60
- os : windows-latest
61
61
noxenv : readme
Original file line number Diff line number Diff line change 1
1
from pathlib import Path
2
+ import os
2
3
3
4
import nox
4
5
@@ -47,27 +48,36 @@ def tests(session, installable):
47
48
48
49
session .install ("virtue" , installable )
49
50
50
- if session .posargs and session .posargs [0 ] in {"coverage" , "ghcoverage" }:
51
- ghcoverage = session .posargs .pop (0 ) == "ghcoverage"
51
+ if session .posargs and session .posargs [0 ] == "coverage" :
52
+ if len (session .posargs ) > 1 and session .posargs [1 ] == "github" :
53
+ posargs = session .posargs [2 :]
54
+ github = os .environ ["GITHUB_STEP_SUMMARY" ]
55
+ else :
56
+ posargs , github = session .posargs [1 :], None
52
57
53
58
session .install ("coverage[toml]" )
54
59
session .run (
55
60
"coverage" ,
56
61
"run" ,
57
- * session . posargs ,
62
+ * posargs ,
58
63
"-m" ,
59
64
"virtue" ,
60
65
PACKAGE ,
61
66
env = env ,
62
67
)
63
- session .run ("coverage" , "report" )
64
-
65
- if ghcoverage :
66
- session .run (
67
- "sh" ,
68
- ROOT / ".github/coverage.sh" ,
69
- f"{ session .bin } /python" ,
70
- )
68
+
69
+ if github is None :
70
+ session .run ("coverage" , "report" )
71
+ else :
72
+ with open (github , "a" ) as summary :
73
+ summary .write ("### Coverage\n \n " )
74
+ summary .flush () # without a flush, output seems out of order.
75
+ session .run (
76
+ "coverage" ,
77
+ "report" ,
78
+ "--format=markdown" ,
79
+ stdout = summary ,
80
+ )
71
81
else :
72
82
session .run ("virtue" , * session .posargs , PACKAGE , env = env )
73
83
You can’t perform that action at this time.
0 commit comments