File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -621,6 +621,27 @@ def _importtestmodule(self):
621
621
622
622
623
623
class Package (Module ):
624
+ @classmethod
625
+ def from_parent (
626
+ cls ,
627
+ parent ,
628
+ * ,
629
+ name = None ,
630
+ fs_path : Optional [Path ] = None ,
631
+ fspath : Optional [py .path .local ] = None ,
632
+ ** kw ,
633
+ ):
634
+ if name is None :
635
+ if fs_path is not None :
636
+ name = fs_path .parent .name
637
+ elif fspath is not None :
638
+ fs_path = Path (fspath )
639
+ name = fs_path .parent .name
640
+ else :
641
+ raise TypeError ("name required" )
642
+
643
+ return super ().from_parent (parent = parent , name = name , fs_path = fs_path , ** kw )
644
+
624
645
def setup (self ) -> None :
625
646
# Not using fixtures to call setup_module here because autouse fixtures
626
647
# from packages are not called automatically (#4085).
You can’t perform that action at this time.
0 commit comments