-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[test] Parallelize long-running pytest files
- Loading branch information
Showing
6 changed files
with
102 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import contextlib | ||
import os | ||
import tempfile | ||
|
||
|
||
def findTestFile(relativePathOrName): | ||
for i in range(3): | ||
path = os.path.sep.join([".."] * i + ["tests", relativePathOrName]) | ||
if os.path.exists(path): | ||
return path | ||
return relativePathOrName | ||
|
||
|
||
@contextlib.contextmanager | ||
def copyTestFile(relativePathOrName): | ||
with tempfile.TemporaryDirectory() as folder: | ||
path = os.path.join(folder, os.path.basename(relativePathOrName)) | ||
with open(findTestFile(relativePathOrName), 'rb') as file, open(path, 'wb') as target: | ||
target.write(file.read()) | ||
yield path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters