return None
def get_pydevd_file(self):
- dirname = os.path.dirname(__file__)
- dirname = os.path.dirname(dirname)
- return os.path.abspath(os.path.join(dirname, 'pydevd.py'))
+ import pydevd
+ return pydevd.__file__
def get_pydevconsole_file(self):
- dirname = os.path.dirname(__file__)
- dirname = os.path.dirname(dirname)
- return os.path.abspath(os.path.join(dirname, 'pydevconsole.py'))
+ import pydevconsole
+ return pydevconsole.__file__
def get_line_index_with_content(self, line_content, filename=None):
'''
foo_module = 'tests_python.resources.launch.foo'
pydevd_dir = os.path.dirname(os.path.dirname(__file__))
- assert os.path.exists(os.path.join(pydevd_dir, 'pydevd.py'))
+ if os.path.exists(os.path.join(pydevd_dir, 'pydevd.py')):
+ append_path = 'sys.path.append(%r)' % pydevd_dir
+ else:
+ append_path = ''
_run_and_check(testdir_or_pytester, testdir_or_pytester.makepyfile('''
import sys
-sys.path.append(%(pydevd_dir)r)
+%(append_path)s
import pydevd
py_db = pydevd.PyDB()
py_db.ready_to_run = True
_run_and_check(testdir_or_pytester, testdir_or_pytester.makepyfile('''
import sys
-sys.path.append(%(pydevd_dir)r)
+%(append_path)s
import pydevd
py_db = pydevd.PyDB()
py_db.run(%(foo_dir)r, set_trace=False)
_run_and_check(testdir_or_pytester, testdir_or_pytester.makepyfile('''
import sys
-sys.path.append(%(pydevd_dir)r)
+%(append_path)s
sys.argv.append('--as-module')
import pydevd
py_db = pydevd.PyDB()
_run_and_check(testdir_or_pytester, testdir_or_pytester.makepyfile('''
import sys
sys.argv.append('--as-module')
-sys.path.append(%(pydevd_dir)r)
+%(append_path)s
import pydevd
py_db = pydevd.PyDB()
py_db.run(%(foo_module)r, is_module=True, set_trace=False)
import os
pydevd_dir = os.path.dirname(os.path.dirname(__file__))
- assert os.path.exists(os.path.join(pydevd_dir, 'pydevd.py'))
+ if os.path.exists(os.path.join(pydevd_dir, 'pydevd.py')):
+ append_path = 'sys.path.append(%r)' % pydevd_dir
+ else:
+ append_path = ''
foo_module = 'local_foo'
with open(os.path.join(os.getcwd(), 'local_foo.py'), 'w') as stream:
_run_and_check(testdir_or_pytester, testdir_or_pytester.makepyfile('''
import sys
import os
-sys.path.append(%(pydevd_dir)r)
+%(append_path)s
sys.argv.append('--as-module')
cwd = os.path.abspath(os.getcwd())
while cwd in sys.path:
import sys
import os
sys.argv.append('--as-module')
-sys.path.append(%(pydevd_dir)r)
+%(append_path)s
cwd = os.path.abspath(os.getcwd())
while cwd in sys.path:
sys.path.remove(cwd)
cwd = os.path.abspath(os.path.dirname(__file__))
assert os.path.isdir(cwd)
- resources_dir = os.path.join(os.path.dirname(pydevd.__file__), 'tests_python', 'resources')
+ resources_dir = os.path.join(cwd, 'resources')
assert os.path.isdir(resources_dir)
attach_to_process_dir = os.path.join(os.path.dirname(pydevd.__file__), 'pydevd_attach_to_process')
cwd=cwd
)
- resources_dir = os.path.join(os.path.dirname(pydevd.__file__), 'tests_python', 'resources')
+ resources_dir = os.path.join(os.path.dirname(__file__), 'resources')
subprocess.check_call(
[sys.executable, os.path.join(resources_dir, '_pydevd_test_find_main_thread_id.py') ],