forked from microsoft/debugpy
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support module with __file__=None. Fixes microsoft#475
- Loading branch information
Showing
5 changed files
with
67 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
def test_vendoring(pyfile): | ||
@pyfile | ||
def import_debugpy(): | ||
import sys | ||
|
||
class Dummy(object): | ||
__file__ = None | ||
|
||
class Dummy2(object): | ||
pass | ||
|
||
class Dummy3(object): | ||
def __getattribute__(self, *args, **kwargs): | ||
raise AssertionError('Error') | ||
|
||
sys.modules["pydev_dummy"] = Dummy() | ||
sys.modules["pydev_dummy2"] = Dummy2() | ||
sys.modules["pydev_dummy3"] = Dummy3() | ||
|
||
sys.modules["_pydev_dummy"] = Dummy() | ||
sys.modules["_pydev_dummy2"] = Dummy2() | ||
sys.modules["_pydev_dummy3"] = Dummy3() | ||
|
||
from debugpy._vendored import force_pydevd # noqa | ||
|
||
print("Properly applied pydevd vendoring.") | ||
|
||
import subprocess | ||
import sys | ||
|
||
output = subprocess.check_output([sys.executable, "-u", import_debugpy.strpath]) | ||
output = output.decode("utf-8") | ||
if "Properly applied pydevd vendoring." not in output: | ||
raise AssertionError(output) |