33
44from __future__ import annotations
55
6- import os
76import sys
7+ from pathlib import Path
88
9- sys .path .insert (0 , os . path . join ( os . path . dirname (__file__ ), ".." ))
9+ sys .path .insert (0 , str ( Path (__file__ ). parent . parent ))
1010from check_release_notes import (
1111 check_release_notes ,
1212 is_post_release ,
@@ -87,43 +87,43 @@ def _make_notes(self, tmp_path, pkg, version, content="Release notes."):
8787
8888 def test_present_and_nonempty (self , tmp_path ):
8989 self ._make_notes (tmp_path , "cuda_core" , "0.7.0" )
90- problems = check_release_notes ("cuda-core-v0.7.0" , "cuda-core" , str ( tmp_path ) )
90+ problems = check_release_notes ("cuda-core-v0.7.0" , "cuda-core" , tmp_path )
9191 assert problems == []
9292
9393 def test_missing (self , tmp_path ):
94- problems = check_release_notes ("cuda-core-v0.7.0" , "cuda-core" , str ( tmp_path ) )
94+ problems = check_release_notes ("cuda-core-v0.7.0" , "cuda-core" , tmp_path )
9595 assert len (problems ) == 1
9696 assert problems [0 ][1 ] == "missing"
9797
9898 def test_empty (self , tmp_path ):
9999 self ._make_notes (tmp_path , "cuda_core" , "0.7.0" , content = "" )
100- problems = check_release_notes ("cuda-core-v0.7.0" , "cuda-core" , str ( tmp_path ) )
100+ problems = check_release_notes ("cuda-core-v0.7.0" , "cuda-core" , tmp_path )
101101 assert len (problems ) == 1
102102 assert problems [0 ][1 ] == "empty"
103103
104104 def test_post_release_skipped (self , tmp_path ):
105- problems = check_release_notes ("v12.6.2.post1" , "cuda-bindings" , str ( tmp_path ) )
105+ problems = check_release_notes ("v12.6.2.post1" , "cuda-bindings" , tmp_path )
106106 assert problems == []
107107
108108 def test_invalid_tag (self , tmp_path ):
109- problems = check_release_notes ("not-a-tag" , "cuda-core" , str ( tmp_path ) )
109+ problems = check_release_notes ("not-a-tag" , "cuda-core" , tmp_path )
110110 assert len (problems ) == 1
111111 assert "cannot parse" in problems [0 ][1 ]
112112
113113 def test_component_prefix_mismatch (self , tmp_path ):
114114 # Pass a cuda-core tag with component=cuda-pathfinder; must be rejected.
115- problems = check_release_notes ("cuda-core-v0.7.0" , "cuda-pathfinder" , str ( tmp_path ) )
115+ problems = check_release_notes ("cuda-core-v0.7.0" , "cuda-pathfinder" , tmp_path )
116116 assert len (problems ) == 1
117117 assert "cannot parse" in problems [0 ][1 ]
118118
119119 def test_unknown_component (self , tmp_path ):
120- problems = check_release_notes ("v13.1.0" , "bogus" , str ( tmp_path ) )
120+ problems = check_release_notes ("v13.1.0" , "bogus" , tmp_path )
121121 assert len (problems ) == 1
122122 assert "unknown component" in problems [0 ][1 ]
123123
124124 def test_plain_v_tag (self , tmp_path ):
125125 self ._make_notes (tmp_path , "cuda_python" , "13.1.0" )
126- problems = check_release_notes ("v13.1.0" , "cuda-python" , str ( tmp_path ) )
126+ problems = check_release_notes ("v13.1.0" , "cuda-python" , tmp_path )
127127 assert problems == []
128128
129129
@@ -133,17 +133,17 @@ def test_from_versions_yml(self, tmp_path):
133133 d .mkdir (parents = True )
134134 (d / "versions.yml" ).write_text ('backport_branch: "12.9.x"\n ' )
135135
136- assert load_backport_branch (str ( tmp_path ) ) == "12.9.x"
136+ assert load_backport_branch (tmp_path ) == "12.9.x"
137137
138138 def test_from_github_ref_name_for_legacy_backport_branch (self , tmp_path , monkeypatch ):
139139 monkeypatch .setenv ("GITHUB_REF_NAME" , "12.9.x" )
140140
141- assert load_backport_branch (str ( tmp_path ) ) == "12.9.x"
141+ assert load_backport_branch (tmp_path ) == "12.9.x"
142142
143143 def test_ignores_non_backport_github_ref_name (self , tmp_path , monkeypatch ):
144144 monkeypatch .setenv ("GITHUB_REF_NAME" , "main" )
145145
146- assert load_backport_branch (str ( tmp_path ) ) is None
146+ assert load_backport_branch (tmp_path ) is None
147147
148148
149149class TestMain :
0 commit comments