-
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.
- call read_job_metadata_from_file from tools/job_metadata.py - moved one test from tests for EESSIBotSoftwareLayerJobManager to tests for tools/job_metadata.py
- Loading branch information
Showing
3 changed files
with
37 additions
and
40 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,34 @@ | ||
# 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 | ||
import shutil | ||
|
||
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 |