@@ -361,6 +361,38 @@ describe('Import tests that can run with or without a true venv', () => {
361361 ) ;
362362 } ) ;
363363
364+ test ( 'py.typed namespace package plus stubs' , ( ) => {
365+ const typingFolder = combinePaths ( normalizeSlashes ( '/' ) , 'typing' ) ;
366+ const files = [
367+ {
368+ path : combinePaths ( typingFolder , 'myLib/core' , 'foo.pyi' ) ,
369+ content : 'def test(): pass' ,
370+ } ,
371+ {
372+ path : combinePaths ( libraryRoot , 'myLib' , 'py.typed' ) ,
373+ content : '' ,
374+ } ,
375+ {
376+ path : combinePaths ( libraryRoot , 'myLib' , '__init__.py' ) ,
377+ content : 'def test(): pass' ,
378+ } ,
379+ {
380+ path : combinePaths ( libraryRoot , 'myLib' , '__init__.pyi' ) ,
381+ content : 'def test(): pass' ,
382+ } ,
383+ ] ;
384+
385+ const importResult = getImportResult ( files , [ 'myLib' ] , ( c ) => ( c . stubPath = Uri . file ( typingFolder ) ) ) ;
386+ assert ( importResult . isImportFound ) ;
387+ assert ( importResult . isStubFile ) ;
388+ assert . strictEqual (
389+ 1 ,
390+ importResult . resolvedUris . filter (
391+ ( f ) => ! f . isEmpty ( ) && f . getFilePath ( ) === combinePaths ( libraryRoot , 'myLib' , '__init__.pyi' )
392+ ) . length
393+ ) ;
394+ } ) ;
395+
364396 test ( 'stub in typing folder over partial stub package' , ( ) => {
365397 const typingFolder = combinePaths ( normalizeSlashes ( '/' ) , 'typing' ) ;
366398 const files = [
0 commit comments