-
Notifications
You must be signed in to change notification settings - Fork 167
Check skipenv #24
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
Check skipenv #24
Conversation
unit_test: | ||
machine: | ||
enabled: true | ||
image: "ubuntu-1604:201903-01" |
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.
Do we need the machine executor here? Or would tests run faster in a Docker executor?
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.
Yes, so that I can run against py2 and py3.
hooks/check_skip_env.py
Outdated
def has_setenv_skip(fpath): | ||
with open(fpath) as f: | ||
for line in f: | ||
if re.match(r'^\s+os.Setenv\(\"SKIP_', line): |
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.
It's not likely, but perhaps possible someone calls os.Setenv
right at the start of a line of code? Also, there may be extra whitespace.
if re.match(r'^\s+os.Setenv\(\"SKIP_', line): | |
if re.match(r'^\s*os.Setenv\s*\(\s*\"SKIP_', line): |
Also, consider checking for os.Setenv("TERRATEST_REGION
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.
It's not likely, but perhaps possible someone calls os.Setenv right at the start of a line of code? Also, there may be extra whitespace.
This would be formatted away with go fmt
, so I don't think it is necessary.
Also, consider checking for os.Setenv("TERRATEST_REGION
Added in! e20ca37
Ok going to merge and release. Thanks for review! |
Introduce a pre-commit hook that uses a regex based method of checking for uncommented
os.Setenv
calls for setting terratest skip environments.