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:
5252 include :
5353 - os : ubuntu-latest
5454 noxenv : " tests-3.11(format)"
55- posargs : ghcoverage
55+ posargs : coverage github
5656 - os : ubuntu-latest
5757 noxenv : " tests-3.11(no-extras)"
58- posargs : ghcoverage
58+ posargs : coverage github
5959 exclude :
6060 - os : windows-latest
6161 noxenv : readme
Original file line number Diff line number Diff line change 11from pathlib import Path
2+ import os
23
34import nox
45
@@ -47,27 +48,36 @@ def tests(session, installable):
4748
4849 session .install ("virtue" , installable )
4950
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
5257
5358 session .install ("coverage[toml]" )
5459 session .run (
5560 "coverage" ,
5661 "run" ,
57- * session . posargs ,
62+ * posargs ,
5863 "-m" ,
5964 "virtue" ,
6065 PACKAGE ,
6166 env = env ,
6267 )
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+ )
7181 else :
7282 session .run ("virtue" , * session .posargs , PACKAGE , env = env )
7383
You can’t perform that action at this time.
0 commit comments