提交 63aa6df6 编写于 作者: C Cleber Rosa

virtualenv: allow tests to run properly on them

While going through the dependency list (requirements*.txt files) and
performing our self tests out of virtual environments, I noticed that
some tests are run outside the virtual environments.

The reason is that, even though the virtual environment is activated
for the test session (and say, `which python` gives `/venv/bin/python`),
we have hard coded `/usr/bin/python` in most places.

According to the some discussions on the virtualenv project itself[1],
a quick solution is to revert to the also common `/usr/bin/env python`
way of pointing to the Python interpreter.

[1] - https://github.com/pypa/virtualenv/issues/124Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 8d8f7c65
#!/usr/bin/python
#!/usr/bin/env python
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......
#!/usr/bin/python
#!/usr/bin/env python
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......
#!/usr/bin/python
#!/usr/bin/env python
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......
#!/usr/bin/python
#!/usr/bin/env python
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......
......@@ -282,7 +282,7 @@ say you want to pick up a test suite written in C that it is in a tarball,
uncompress it, compile the suite code, and then executing the test. Here's
an example that does that::
#!/usr/bin/python
#!/usr/bin/env python
import os
......
#!/usr/bin/python
#!/usr/bin/env python
import os
......
#!/usr/bin/python
#!/usr/bin/env python
import os
import shutil
......
#!/usr/bin/python
#!/usr/bin/env python
import os
import shutil
......
#!/usr/bin/python
#!/usr/bin/env python
from avocado import Test
from avocado import main
......
#!/usr/bin/python
#!/usr/bin/env python
import os
import shutil
......
#!/usr/bin/python
#!/usr/bin/env python
import os
import shutil
......
#!/usr/bin/python
#!/usr/bin/env python
from avocado import Test
from avocado import main
......
#!/usr/bin/python
#!/usr/bin/env python
from avocado import Test
from avocado import main
......
#!/usr/bin/python
#!/usr/bin/env python
from avocado import Test
from avocado import main
......
#!/usr/bin/python
#!/usr/bin/env python
from avocado import Test
from avocado import main
......
#!/usr/bin/python
#!/usr/bin/env python
import avocado
......
#!/usr/bin/python
#!/usr/bin/env python
from avocado import Test
from avocado import main
......
#!/usr/bin/python
#!/usr/bin/env python
import os
......
#!/usr/bin/python
#!/usr/bin/env python
import os
......
#!/usr/bin/python
#!/usr/bin/env python
import os
......
#!/usr/bin/python
#!/usr/bin/env python
from avocado import Test
from avocado import main
......
#!/usr/bin/python
#!/usr/bin/env python
import os
import shutil
......
#!/usr/bin/python
#!/usr/bin/env python
from avocado import Test
from avocado import main
......
#!/usr/bin/python
#!/usr/bin/env python
from avocado import Test
from avocado import main
......
#!/usr/bin/python
#!/usr/bin/env python
from avocado import main
from avocado import Test
......
#!/usr/bin/python
#!/usr/bin/env python
import os
import shutil
......
#!/usr/bin/python
#!/usr/bin/env python
import avocado
......
#!/usr/bin/python
#!/usr/bin/env python
from avocado import Test
from avocado import main
......
#!/usr/bin/python
#!/usr/bin/env python
import os
import time
......
#!/usr/bin/python
#!/usr/bin/env python
import time
......
#!/usr/bin/python
#!/usr/bin/env python
import os
......
#!/usr/bin/python
#!/usr/bin/env python
import time
......
#!/usr/bin/python
#!/usr/bin/env python
import os
......
#!/usr/bin/python
#!/usr/bin/env python
from avocado import Test
from avocado import main
......
#!/usr/bin/python
#!/usr/bin/env python
from avocado import Test
from avocado import main
......
#!/usr/bin/python
#!/usr/bin/env python
import base64
......
......@@ -33,7 +33,7 @@ if __name__ == "__main__":
time.sleep(0.1)
"""
GOOD_TEST = """#!/usr/bin/python
GOOD_TEST = """#!/usr/bin/env python
import time
from avocado import Test
from avocado import main
......
......@@ -17,7 +17,7 @@ basedir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')
basedir = os.path.abspath(basedir)
AVOCADO_TEST_OK = """#!/usr/bin/python
AVOCADO_TEST_OK = """#!/usr/bin/env python
from avocado import Test
from avocado import main
......@@ -30,7 +30,7 @@ if __name__ == "__main__":
"""
AVOCADO_TEST_SLEEP_ELEVEN = """#!/usr/bin/python
AVOCADO_TEST_SLEEP_ELEVEN = """#!/usr/bin/env python
import time
from avocado import Test
......@@ -49,7 +49,7 @@ if __name__ == "__main__":
"""
AVOCADO_TEST_MULTIPLE_CLASSES = """#!/usr/bin/python
AVOCADO_TEST_MULTIPLE_CLASSES = """#!/usr/bin/env python
import time
from avocado import Test
......@@ -73,7 +73,7 @@ def hello():
print('Hello World!')
"""
PY_SIMPLE_TEST = """#!/usr/bin/python
PY_SIMPLE_TEST = """#!/usr/bin/env python
def hello():
print('Hello World!')
......
......@@ -11,7 +11,7 @@ else:
from avocado.utils import process
FAKE_VMSTAT_CONTENTS = """#!/usr/bin/python
FAKE_VMSTAT_CONTENTS = """#!/usr/bin/env python
import time
import random
import signal
......@@ -108,7 +108,7 @@ if __name__ == '__main__':
vmstat.start()
"""
FAKE_UPTIME_CONTENTS = """#!/usr/bin/python
FAKE_UPTIME_CONTENTS = """#!/usr/bin/env python
if __name__ == '__main__':
print("17:56:34 up 8:06, 7 users, load average: 0.26, 0.20, 0.21")
......
......@@ -13,7 +13,7 @@ from avocado.utils import script
# We need to access protected members pylint: disable=W0212
AVOCADO_TEST_OK = """#!/usr/bin/python
AVOCADO_TEST_OK = """#!/usr/bin/env python
from avocado import Test
from avocado import main
......@@ -25,7 +25,7 @@ if __name__ == "__main__":
main()
"""
AVOCADO_TEST_OK_DISABLED = """#!/usr/bin/python
AVOCADO_TEST_OK_DISABLED = """#!/usr/bin/env python
from avocado import Test
from avocado import main
......@@ -46,7 +46,7 @@ def hello():
print('Hello World!')
"""
PY_SIMPLE_TEST = """#!/usr/bin/python
PY_SIMPLE_TEST = """#!/usr/bin/env python
def hello():
print('Hello World!')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册