Skip to content

Commit

Permalink
[tests] Fix ddtrace sitecustomize negative test
Browse files Browse the repository at this point in the history
The current negative test is broken and is actually testing the same case
without `-S`.

That's because the condition `sys.argv[1] is '-S'` is always `False`; strings
must be compared with `==`, not `is`.
  • Loading branch information
jd committed Mar 30, 2019
1 parent a1a3c5f commit 8a26318
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/commands/ddtrace_run_sitecustomize.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

if __name__ == '__main__':
# detect if `-S` is used
suppress = len(sys.argv) == 2 and sys.argv[1] is '-S'
suppress = len(sys.argv) == 2 and sys.argv[1] == '-S'
if suppress:
ok_('sitecustomize' not in sys.modules)
else:
Expand Down
2 changes: 1 addition & 1 deletion tests/commands/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def test_sitecustomize_run_suppressed(self):
# ensure `sitecustomize.py` is not loaded if `-S` is used
env = inject_sitecustomize('tests/commands/bootstrap')
out = subprocess.check_output(
['ddtrace-run', 'python', 'tests/commands/ddtrace_run_sitecustomize.py', '-S'],
['ddtrace-run', 'python', '-S', 'tests/commands/ddtrace_run_sitecustomize.py', '-S'],
env=env,
)
assert out.startswith(b"Test success")
Expand Down

0 comments on commit 8a26318

Please sign in to comment.