-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #247 from trz42/refactor_reading_job_metadata
add function that reads PR section from job metadata and use it in job manager
- Loading branch information
Showing
4 changed files
with
64 additions
and
43 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
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,33 @@ | ||
# Tests for 'tools/job_metadata.py' of the EESSI build-and-deploy bot, | ||
# see https://github.com/EESSI/eessi-bot-software-layer | ||
# | ||
# The bot helps with requests to add software installations to the | ||
# EESSI software layer, see https://github.com/EESSI/software-layer | ||
# | ||
# author: Thomas Roeblitz (@trz42) | ||
# | ||
# license: GPLv2 | ||
# | ||
|
||
import os | ||
|
||
from tools.job_metadata import read_job_metadata_from_file | ||
|
||
|
||
def test_read_job_metadata_from_file(tmpdir): | ||
logfile = os.path.join(tmpdir, 'test_read_job_metadata_from_file.log') | ||
# if metadata file does not exist, we should get None as return value | ||
path = os.path.join(tmpdir, 'test.metadata') | ||
assert read_job_metadata_from_file(path, logfile) is None | ||
|
||
with open(path, 'w') as fp: | ||
fp.write('''[PR] | ||
repo=test | ||
pr_number=12345''') | ||
|
||
metadata_pr = read_job_metadata_from_file(path, logfile) | ||
expected = { | ||
"repo": "test", | ||
"pr_number": "12345", | ||
} | ||
assert metadata_pr == expected |
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