@@ -144,8 +144,7 @@ def setup_commit_history(testproject_path):
144144 Returns:
145145 repo (repo): git.Repo object
146146 """
147- assert not os .path .exists (str (testproject_path / ".git" ))
148- testproject_path = str (testproject_path )
147+ assert not (testproject_path / ".git" ).exists ()
149148
150149 repo = git .Repo .init (testproject_path , bare = False )
151150 repo .git .checkout ("-b" , "master" )
@@ -159,7 +158,7 @@ def setup_commit_history(testproject_path):
159158 message = "add homepage" , author = author , date = "1500854705"
160159 ) # Mon Jul 24 2017 00:05:05 GMT+0000
161160
162- file_name = os . path . join ( testproject_path , "docs/page_with_tag.md" )
161+ file_name = testproject_path / "docs/page_with_tag.md"
163162 with open (file_name , "a" ) as the_file :
164163 the_file .write ("test\n " )
165164 repo .git .add ("docs/page_with_tag.md" )
@@ -175,10 +174,10 @@ def setup_commit_history(testproject_path):
175174 ) # Sun Jan 23 2022 04:10:26 GMT+0000
176175
177176 if os .path .exists ("docs/page_with_renamed.md" ):
178- bf_file_name = os . path . join ( testproject_path , "docs/page_with_renamed.md" )
179- af_file_name = os . path . join ( testproject_path , "docs/subfolder/page_with_renamed.md" )
177+ bf_file_name = testproject_path / "docs/page_with_renamed.md"
178+ af_file_name = testproject_path / "docs/subfolder/page_with_renamed.md"
180179 # Since git.mv would actually remove the file, move page_with_renamed.md back to docs if it has been moved
181- if os . path . exists (af_file_name ):
180+ if af_file_name . exists ():
182181 os .replace (af_file_name , bf_file_name )
183182 repo .git .add ("docs/page_with_renamed.md" )
184183 repo .git .commit (
@@ -192,7 +191,7 @@ def setup_commit_history(testproject_path):
192191 if os .path .exists ("docs/first_page.md" ):
193192 repo .git .add ("docs/first_page.md" )
194193 repo .git .commit (message = "first page" , author = author , date = "1500854705" ) # Mon Jul 24 2017 00:05:05 GMT+0000
195- file_name = os . path . join ( testproject_path , "docs/first_page.md" )
194+ file_name = testproject_path / "docs/first_page.md"
196195 with open (file_name , "w+" ) as the_file :
197196 the_file .write ("Hello\n " )
198197 repo .git .add ("docs/first_page.md" )
@@ -211,7 +210,7 @@ def setup_commit_history(testproject_path):
211210 message = "add mkdocs" , author = author , date = "1500854705 -0700"
212211 ) # Mon Jul 24 2017 00:05:05 GMT+0000
213212
214- if os . path . exists ("docs/second_page.md" ):
213+ if Path ("docs/second_page.md" ). exists ( ):
215214 repo .git .add ("docs/second_page.md" )
216215 repo .git .commit (
217216 message = "second page" , author = author , date = "1643911026"
0 commit comments