Skip to content
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

Use platform specific command to find path #1143

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions tests/test_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import sys
import os
import subprocess
import sysconfig
import platform

try:
# python2
Expand Down Expand Up @@ -81,18 +83,15 @@ def setUp(self):
def run_test(self):
if self.SHELL_OUT:
# make sure its on the path
try:
subprocess.check_call(
[
"which", sys.argv[0]
],
stdout=subprocess.PIPE
)
except subprocess.CalledProcessError:
console_script = os.path.join(sysconfig.get_path('scripts'), sys.argv[0])
if platform.system() == 'Windows':
console_script += '.exe'

if not os.path.exists(console_script):
self.fail(
"Could not find '{}' on $PATH. Tests that explicitly shell"
"Could not find '{}'. Tests that explicitly shell"
" out can be disabled by setting the environment variable "
"OTIO_DISABLE_SHELLOUT_TESTS.".format(sys.argv[0])
"OTIO_DISABLE_SHELLOUT_TESTS.".format(console_script)
)

# actually run the test (sys.argv is already populated correctly)
Expand Down