Skip to content

Commit

Permalink
use different stubs in test (python#3044)
Browse files Browse the repository at this point in the history
Use dedicated dummy names instead of other real modules.
  • Loading branch information
JelleZijlstra authored and gvanrossum committed Mar 24, 2017
1 parent a7e18eb commit 5434979
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
6 changes: 6 additions & 0 deletions mypy/moduleinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@
'PyQt4',
'PyQt5',
'pylons',

# for use in tests
'__dummy_third_party1',
}

# Modules and packages common to Python 2.7 and 3.x.
Expand Down Expand Up @@ -422,6 +425,9 @@
'xml.sax.xmlreader',
'zipfile',
'zlib',
# fake names to use in tests
'__dummy_stdlib1',
'__dummy_stdlib2',
}

# Python 2 standard library modules.
Expand Down
16 changes: 8 additions & 8 deletions test-data/unit/semanal-errors.test
Original file line number Diff line number Diff line change
Expand Up @@ -1289,24 +1289,24 @@ y = 1
[out]

[case testMissingStubForThirdPartyModule]
import nosexcover
import __dummy_third_party1
[out]
main:1: error: No library stub file for module 'nosexcover'
main:1: error: No library stub file for module '__dummy_third_party1'
main:1: note: (Stub files are from https://github.com/python/typeshed)

[case testMissingStubForStdLibModule]
import tabnanny
import __dummy_stdlib1
[out]
main:1: error: No library stub file for standard library module 'tabnanny'
main:1: error: No library stub file for standard library module '__dummy_stdlib1'
main:1: note: (Stub files are from https://github.com/python/typeshed)

[case testMissingStubForTwoModules]
import tabnanny
import xdrlib
import __dummy_stdlib1
import __dummy_stdlib2
[out]
main:1: error: No library stub file for standard library module 'tabnanny'
main:1: error: No library stub file for standard library module '__dummy_stdlib1'
main:1: note: (Stub files are from https://github.com/python/typeshed)
main:2: error: No library stub file for standard library module 'xdrlib'
main:2: error: No library stub file for standard library module '__dummy_stdlib2'

[case testListComprehensionSpecialScoping]
class A:
Expand Down

0 comments on commit 5434979

Please sign in to comment.