-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--new-pr can't be empty #1846
--new-pr can't be empty #1846
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,8 +47,8 @@ | |
from easybuild.tools.config import DEFAULT_MODULECLASSES | ||
from easybuild.tools.config import find_last_log, get_build_log_path, get_module_syntax, module_classes | ||
from easybuild.tools.environment import modify_env | ||
from easybuild.tools.filetools import mkdir, read_file, write_file | ||
from easybuild.tools.github import fetch_github_token | ||
from easybuild.tools.filetools import download_file, mkdir, read_file, write_file | ||
from easybuild.tools.github import GITHUB_RAW, GITHUB_EB_MAIN, GITHUB_EASYCONFIGS_REPO, URL_SEPARATOR, fetch_github_token | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. line too long, stay under 120 chars |
||
from easybuild.tools.options import EasyBuildOptions, parse_external_modules_metadata, set_tmpdir | ||
from easybuild.tools.toolchain.utilities import TC_CONST_PREFIX | ||
from easybuild.tools.run import run_cmd | ||
|
@@ -2350,6 +2350,34 @@ def test_new_update_pr(self): | |
regex = re.compile(regex, re.M) | ||
self.assertTrue(regex.search(txt), "Pattern '%s' found in: %s" % (regex.pattern, txt)) | ||
|
||
def test_empty_pr(self): | ||
"""Test use of --new-pr (dry run only) with no changes""" | ||
if self.github_token is None: | ||
print "Skipping test_new_pr, no GitHub token available?" | ||
return | ||
|
||
# get file from develop branch | ||
test_ecs_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. download to otherwise if this test fails, the downloaded easyconfigs will stick around in |
||
full_url = URL_SEPARATOR.join([GITHUB_RAW, GITHUB_EB_MAIN, GITHUB_EASYCONFIGS_REPO, 'develop/easybuild/easyconfigs/z/zlib/zlib-1.2.8.eb']) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tooooooo long |
||
ec = download_file('zlib-1.2.8.eb', full_url, path=os.path.join(test_ecs_dir, 'zlib-1.2.8.eb'), forced=True) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. try to use |
||
|
||
# try to open new pr with unchanged file | ||
os.environ['EASYBUILD_GITHUB_USER'] = GITHUB_TEST_ACCOUNT | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use |
||
args = [ | ||
'--new-pr', | ||
'--experimental', | ||
ec, | ||
'-D', | ||
] | ||
|
||
self.mock_stdout(True) | ||
error_msg = 'No changed files found. Refused to make empty pull request.' | ||
self.assertErrorRegex(EasyBuildError, error_msg, self.eb_main, args, do_build=True, raise_error=True) | ||
self.mock_stdout(False) | ||
|
||
os.remove(os.path.join(test_ecs_dir, 'zlib-1.2.8.eb')) | ||
|
||
|
||
def test_show_config(self): | ||
""""Test --show-config and --show-full-config.""" | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clarify error message, somehow mention that you were comparing with current
develop
branch (but keep it short, people don't actually read long errors ;-))