From The Compiler, 5 Months ago, written in Plain Text.
Embed
  1. PS C:\Users\Florian\proj> pytest .\test_file.py --fulltrace -v
  2. ============================= test session starts =============================
  3. platform win32 -- Python 3.6.5, pytest-3.6.2, py-1.5.3, pluggy-0.6.0 -- c:\program files\python36\python.exe
  4. cachedir: .pytest_cache
  5. rootdir: C:\Users\Florian\proj, inifile:
  6. collecting 0 items
  7. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  8.  
  9. name = 'test.test_file', path = ['c:\\program files\\python36\\lib\\test']
  10. target = None
  11.  
  12. >   ???
  13. E   AttributeError: 'AssertionRewritingHook' object has no attribute 'find_spec'
  14.  
  15. <frozen importlib._bootstrap>:888: AttributeError
  16.  
  17. During handling of the above exception, another exception occurred:
  18.  
  19. dir = 'c:\\program files\\python36\\lib\\test\\__pycache__', pre = 'tmp'
  20. suf = '', flags = 34050, output_type = <class 'str'>
  21.  
  22.     def _mkstemp_inner(dir, pre, suf, flags, output_type):
  23.         """Code common to mkstemp, TemporaryFile, and NamedTemporaryFile."""
  24.  
  25.         names = _get_candidate_names()
  26.         if output_type is bytes:
  27.             names = map(_os.fsencode, names)
  28.  
  29.         for seq in range(TMP_MAX):
  30.             name = next(names)
  31.             file = _os.path.join(dir, pre + name + suf)
  32.             try:
  33. >               fd = _os.open(file, flags, 0o600)
  34. E               PermissionError: [Errno 13] Permission denied: 'c:\\program files\\python36\\lib\\test\\__pycache__\\tmppnxn1ld2'
  35.  
  36. c:\program files\python36\lib\tempfile.py:260: PermissionError
  37.  
  38. During handling of the above exception, another exception occurred:
  39.  
  40. config = <_pytest.config.Config object at 0x00000273A3FAA630>
  41. doit = <function _main at 0x00000273A3B56950>
  42.  
  43.     def wrap_session(config, doit):
  44.         """Skeleton command line program"""
  45.         session = Session(config)
  46.         session.exitstatus = EXIT_OK
  47.         initstate = 0
  48.         try:
  49.             try:
  50.                 config._do_configure()
  51.                 initstate = 1
  52.                 config.hook.pytest_sessionstart(session=session)
  53.                 initstate = 2
  54. >               session.exitstatus = doit(config, session) or 0
  55.  
  56. c:\program files\python36\lib\site-packages\_pytest\main.py:178:
  57. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  58.  
  59. config = <_pytest.config.Config object at 0x00000273A3FAA630>
  60. session = <Session 'proj'>
  61.  
  62.     def _main(config, session):
  63.         """ default command line protocol for initialization, session,
  64.         running tests and reporting. """
  65. >       config.hook.pytest_collection(session=session)
  66.  
  67. c:\program files\python36\lib\site-packages\_pytest\main.py:214:
  68. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  69.  
  70. self = <_HookCaller 'pytest_collection'>, args = ()
  71. kwargs = {'session': <Session 'proj'>}, notincall = set()
  72.  
  73.     def __call__(self, *args, **kwargs):
  74.         if args:
  75.             raise TypeError("hook calling supports only keyword arguments")
  76.         assert not self.is_historic()
  77.         if self.argnames:
  78.             notincall = set(self.argnames) - set(['__multicall__']) - set(
  79.                 kwargs.keys())
  80.             if notincall:
  81.                 warnings.warn(
  82.                     "Argument(s) {} which are declared in the hookspec "
  83.                     "can not be found in this hook call"
  84.                     .format(tuple(notincall)),
  85.                     stacklevel=2,
  86.                 )
  87. >       return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  88.  
  89. c:\program files\python36\lib\site-packages\pluggy\__init__.py:617:
  90. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  91.  
  92. self = <_pytest.config.PytestPluginManager object at 0x00000273A3490D30>
  93. hook = <_HookCaller 'pytest_collection'>
  94. methods = [<pluggy.HookImpl object at 0x00000273A3FBA7F0>, <pluggy.HookImpl object at 0x00000273A40227B8>, <pluggy.HookImpl object at 0x00000273A443ADA0>]
  95. kwargs = {'session': <Session 'proj'>}
  96.  
  97.     def _hookexec(self, hook, methods, kwargs):
  98.         # called from all hookcaller instances.
  99.         # enable_tracing will set its own wrapping function at self._inner_hookexec
  100. >       return self._inner_hookexec(hook, methods, kwargs)
  101.  
  102. c:\program files\python36\lib\site-packages\pluggy\__init__.py:222:
  103. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  104.  
  105. hook = <_HookCaller 'pytest_collection'>
  106. methods = [<pluggy.HookImpl object at 0x00000273A3FBA7F0>, <pluggy.HookImpl object at 0x00000273A40227B8>, <pluggy.HookImpl object at 0x00000273A443ADA0>]
  107. kwargs = {'session': <Session 'proj'>}
  108.  
  109.     self._inner_hookexec = lambda hook, methods, kwargs: \
  110.         hook.multicall(
  111.             methods, kwargs,
  112. >           firstresult=hook.spec_opts.get('firstresult'),
  113.         )
  114.  
  115. c:\program files\python36\lib\site-packages\pluggy\__init__.py:216:
  116. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  117.  
  118. session = <Session 'proj'>
  119.  
  120.     def pytest_collection(session):
  121. >       return session.perform_collect()
  122.  
  123. c:\program files\python36\lib\site-packages\_pytest\main.py:224:
  124. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  125.  
  126. self = <Session 'proj'>, args = None, genitems = True
  127.  
  128.     def perform_collect(self, args=None, genitems=True):
  129.         hook = self.config.hook
  130.         try:
  131. >           items = self._perform_collect(args, genitems)
  132.  
  133. c:\program files\python36\lib\site-packages\_pytest\main.py:426:
  134. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  135.  
  136. self = <Session 'proj'>, args = ['.\\test_file.py'], genitems = True
  137.  
  138.     def _perform_collect(self, args, genitems):
  139.         if args is None:
  140.             args = self.config.args
  141.         self.trace("perform_collect", self, args)
  142.         self.trace.root.indent += 1
  143.         self._notfound = []
  144.         self._initialpaths = set()
  145.         self._initialparts = []
  146.         self.items = items = []
  147.         for arg in args:
  148.             parts = self._parsearg(arg)
  149.             self._initialparts.append(parts)
  150.             self._initialpaths.add(parts[0])
  151.         rep = collect_one_node(self)
  152.         self.ihook.pytest_collectreport(report=rep)
  153.         self.trace.root.indent -= 1
  154.         if self._notfound:
  155.             errors = []
  156.             for arg, exc in self._notfound:
  157.                 line = "(no name %r in any of %r)" % (arg, exc.args[0])
  158.                 errors.append("not found: %s\n%s" % (arg, line))
  159.                 # XXX: test this
  160.             raise UsageError(*errors)
  161.         if not genitems:
  162.             return rep.result
  163.         else:
  164.             if rep.passed:
  165.                 for node in rep.result:
  166. >                   self.items.extend(self.genitems(node))
  167.  
  168. c:\program files\python36\lib\site-packages\_pytest\main.py:464:
  169. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  170.  
  171. self = <Session 'proj'>, node = <Module 'test_file.py'>
  172.  
  173.     def genitems(self, node):
  174.         self.trace("genitems", node)
  175.         if isinstance(node, nodes.Item):
  176.             node.ihook.pytest_itemcollected(item=node)
  177.             yield node
  178.         else:
  179.             assert isinstance(node, nodes.Collector)
  180. >           rep = collect_one_node(node)
  181.  
  182. c:\program files\python36\lib\site-packages\_pytest\main.py:606:
  183. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  184.  
  185. collector = <Module 'test_file.py'>
  186.  
  187.     def collect_one_node(collector):
  188.         ihook = collector.ihook
  189.         ihook.pytest_collectstart(collector=collector)
  190. >       rep = ihook.pytest_make_collect_report(collector=collector)
  191.  
  192. c:\program files\python36\lib\site-packages\_pytest\runner.py:566:
  193. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  194.  
  195. self = <_HookCaller 'pytest_make_collect_report'>, args = ()
  196. kwargs = {'collector': <Module 'test_file.py'>}, notincall = set()
  197.  
  198.     def __call__(self, *args, **kwargs):
  199.         if args:
  200.             raise TypeError("hook calling supports only keyword arguments")
  201.         assert not self.is_historic()
  202.         if self.argnames:
  203.             notincall = set(self.argnames) - set(['__multicall__']) - set(
  204.                 kwargs.keys())
  205.             if notincall:
  206.                 warnings.warn(
  207.                     "Argument(s) {} which are declared in the hookspec "
  208.                     "can not be found in this hook call"
  209.                     .format(tuple(notincall)),
  210.                     stacklevel=2,
  211.                 )
  212. >       return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  213.  
  214. c:\program files\python36\lib\site-packages\pluggy\__init__.py:617:
  215. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  216.  
  217. self = <_pytest.config.PytestPluginManager object at 0x00000273A3490D30>
  218. hook = <_HookCaller 'pytest_make_collect_report'>
  219. methods = [<pluggy.HookImpl object at 0x00000273A3FD1B38>, <pluggy.HookImpl object at 0x00000273A40222B0>, <pluggy.HookImpl object at 0x00000273A4403908>]
  220. kwargs = {'collector': <Module 'test_file.py'>}
  221.  
  222.     def _hookexec(self, hook, methods, kwargs):
  223.         # called from all hookcaller instances.
  224.         # enable_tracing will set its own wrapping function at self._inner_hookexec
  225. >       return self._inner_hookexec(hook, methods, kwargs)
  226.  
  227. c:\program files\python36\lib\site-packages\pluggy\__init__.py:222:
  228. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  229.  
  230. hook = <_HookCaller 'pytest_make_collect_report'>
  231. methods = [<pluggy.HookImpl object at 0x00000273A3FD1B38>, <pluggy.HookImpl object at 0x00000273A40222B0>, <pluggy.HookImpl object at 0x00000273A4403908>]
  232. kwargs = {'collector': <Module 'test_file.py'>}
  233.  
  234.     self._inner_hookexec = lambda hook, methods, kwargs: \
  235.         hook.multicall(
  236.             methods, kwargs,
  237. >           firstresult=hook.spec_opts.get('firstresult'),
  238.         )
  239.  
  240. c:\program files\python36\lib\site-packages\pluggy\__init__.py:216:
  241. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  242.  
  243. self = <_pytest.capture.CaptureManager object at 0x00000273A3140438>
  244. collector = <Module 'test_file.py'>
  245.  
  246.     @pytest.hookimpl(hookwrapper=True)
  247.     def pytest_make_collect_report(self, collector):
  248.         if isinstance(collector, pytest.File):
  249.             self.resume_global_capture()
  250.             outcome = yield
  251.             out, err = self.suspend_global_capture()
  252. >           rep = outcome.get_result()
  253.  
  254. c:\program files\python36\lib\site-packages\_pytest\capture.py:144:
  255. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  256.  
  257. collector = <Module 'test_file.py'>
  258.  
  259.     def pytest_make_collect_report(collector):
  260. >       call = CallInfo(lambda: list(collector.collect()), "collect")
  261.  
  262. c:\program files\python36\lib\site-packages\_pytest\runner.py:419:
  263. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  264.  
  265. self = <[AttributeError("'CallInfo' object has no attribute 'result'") raised in repr()] CallInfo object at 0x273a4448d68>
  266. func = <function pytest_make_collect_report.<locals>.<lambda> at 0x00000273A443BD08>
  267. when = 'collect', treat_keyboard_interrupt_as_exception = False
  268.  
  269.     def __init__(self, func, when, treat_keyboard_interrupt_as_exception=False):
  270.         #: context of invocation: one of "setup", "call",
  271.         #: "teardown", "memocollect"
  272.         self.when = when
  273.         self.start = time()
  274.         try:
  275. >           self.result = func()
  276.  
  277. c:\program files\python36\lib\site-packages\_pytest\runner.py:198:
  278. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  279.  
  280. >   call = CallInfo(lambda: list(collector.collect()), "collect")
  281.  
  282. c:\program files\python36\lib\site-packages\_pytest\runner.py:419:
  283. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  284.  
  285. self = <Module 'test_file.py'>
  286.  
  287.     def collect(self):
  288. >       self.session._fixturemanager.parsefactories(self)
  289.  
  290. c:\program files\python36\lib\site-packages\_pytest\python.py:461:
  291. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  292.  
  293. self = <_pytest.fixtures.FixtureManager object at 0x00000273A443AB00>
  294. node_or_obj = <Module 'test_file.py'>
  295. nodeid = <object object at 0x00000273A138B1B0>, unittest = False
  296.  
  297.     def parsefactories(self, node_or_obj, nodeid=NOTSET, unittest=False):
  298.         if nodeid is not NOTSET:
  299.             holderobj = node_or_obj
  300.         else:
  301. >           holderobj = node_or_obj.obj
  302.  
  303. c:\program files\python36\lib\site-packages\_pytest\fixtures.py:1150:
  304. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  305.  
  306. self = <Module 'test_file.py'>
  307.  
  308.     def fget(self):
  309.         obj = getattr(self, "_obj", None)
  310.         if obj is None:
  311. >           self._obj = obj = self._getobj()
  312.  
  313. c:\program files\python36\lib\site-packages\_pytest\python.py:265:
  314. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  315.  
  316. self = <Module 'test_file.py'>
  317.  
  318.     def _getobj(self):
  319. >       return self._importtestmodule()
  320.  
  321. c:\program files\python36\lib\site-packages\_pytest\python.py:458:
  322. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  323.  
  324. self = <Module 'test_file.py'>
  325.  
  326.     def _importtestmodule(self):
  327.         # we assume we are only called once per module
  328.         importmode = self.config.getoption("--import-mode")
  329.         try:
  330. >           mod = self.fspath.pyimport(ensuresyspath=importmode)
  331.  
  332. c:\program files\python36\lib\site-packages\_pytest\python.py:468:
  333. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  334.  
  335. self = local('C:\\Users\\Florian\\proj\\test_file.py'), modname = 'test_file'
  336. ensuresyspath = 'prepend'
  337.  
  338.     def pyimport(self, modname=None, ensuresyspath=True):
  339.         """ return path as an imported python module.
  340.  
  341.             If modname is None, look for the containing package
  342.             and construct an according module name.
  343.             The module will be put/looked up in sys.modules.
  344.             if ensuresyspath is True then the root dir for importing
  345.             the file (taking __init__.py files into account) will
  346.             be prepended to sys.path if it isn't there already.
  347.             If ensuresyspath=="append" the root dir will be appended
  348.             if it isn't already contained in sys.path.
  349.             if ensuresyspath is False no modification of syspath happens.
  350.             """
  351.         if not self.check():
  352.             raise py.error.ENOENT(self)
  353.  
  354.         pkgpath = None
  355.         if modname is None:
  356.             pkgpath = self.pypkgpath()
  357.             if pkgpath is not None:
  358.                 pkgroot = pkgpath.dirpath()
  359.                 names = self.new(ext="").relto(pkgroot).split(self.sep)
  360.                 if names[-1] == "__init__":
  361.                     names.pop()
  362.                 modname = ".".join(names)
  363.             else:
  364.                 pkgroot = self.dirpath()
  365.                 modname = self.purebasename
  366.  
  367.             self._ensuresyspath(ensuresyspath, pkgroot)
  368. >           __import__(modname)
  369.  
  370. c:\program files\python36\lib\site-packages\py\_path\local.py:668:
  371. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  372.  
  373. name = 'test_file', import_ = <built-in function __import__>
  374.  
  375. >   ???
  376.  
  377. <frozen importlib._bootstrap>:971:
  378. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  379.  
  380. name = 'test_file', import_ = <built-in function __import__>
  381.  
  382. >   ???
  383.  
  384. <frozen importlib._bootstrap>:955:
  385. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  386.  
  387. spec = ModuleSpec(name='test_file', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x00000273A4099AC8>)
  388.  
  389. >   ???
  390.  
  391. <frozen importlib._bootstrap>:656:
  392. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  393.  
  394. spec = ModuleSpec(name='test_file', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x00000273A4099AC8>)
  395.  
  396. >   ???
  397.  
  398. <frozen importlib._bootstrap>:626:
  399. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  400.  
  401. self = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x00000273A4099AC8>
  402. name = 'test_file'
  403.  
  404.     def load_module(self, name):
  405.         # If there is an existing module object named 'fullname' in
  406.         # sys.modules, the loader must use that existing module. (Otherwise,
  407.         # the reload() builtin will not work correctly.)
  408.         if name in sys.modules:
  409.             return sys.modules[name]
  410.  
  411.         co, pyc = self.modules.pop(name)
  412.         # I wish I could just call imp.load_compiled here, but __file__ has to
  413.         # be set properly. In Python 3.2+, this all would be handled correctly
  414.         # by load_compiled.
  415.         mod = sys.modules[name] = imp.new_module(name)
  416.         try:
  417.             mod.__file__ = co.co_filename
  418.             # Normally, this attribute is 3.2+.
  419.             mod.__cached__ = pyc
  420.             mod.__loader__ = self
  421. >           py.builtin.exec_(co, mod.__dict__)
  422.  
  423. c:\program files\python36\lib\site-packages\_pytest\assertion\rewrite.py:216:
  424. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  425.  
  426. >   from test import test_file
  427.  
  428. test_file.py:1:
  429. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  430.  
  431. name = 'test.test_file', import_ = <built-in function __import__>
  432.  
  433. >   ???
  434.  
  435. <frozen importlib._bootstrap>:971:
  436. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  437.  
  438. name = 'test.test_file', import_ = <built-in function __import__>
  439.  
  440. >   ???
  441.  
  442. <frozen importlib._bootstrap>:951:
  443. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  444.  
  445. name = 'test.test_file', path = ['c:\\program files\\python36\\lib\\test']
  446. target = None
  447.  
  448. >   ???
  449.  
  450. <frozen importlib._bootstrap>:890:
  451. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  452.  
  453. finder = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x00000273A4099AC8>
  454. name = 'test.test_file', path = ['c:\\program files\\python36\\lib\\test']
  455.  
  456. >   ???
  457.  
  458. <frozen importlib._bootstrap>:864:
  459. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  460.  
  461. self = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x00000273A4099AC8>
  462. name = 'test.test_file', path = ['c:\\program files\\python36\\lib\\test']
  463.  
  464.     def find_module(self, name, path=None):
  465.         state = self.config._assertstate
  466.         state.trace("find_module called for: %s" % name)
  467.         names = name.rsplit(".", 1)
  468.         lastname = names[-1]
  469.         pth = None
  470.         if path is not None:
  471.             # Starting with Python 3.3, path is a _NamespacePath(), which
  472.             # causes problems if not converted to list.
  473.             path = list(path)
  474.             if len(path) == 1:
  475.                 pth = path[0]
  476.         if pth is None:
  477.             try:
  478.                 fd, fn, desc = imp.find_module(lastname, path)
  479.             except ImportError:
  480.                 return None
  481.             if fd is not None:
  482.                 fd.close()
  483.             tp = desc[2]
  484.             if tp == imp.PY_COMPILED:
  485.                 if hasattr(imp, "source_from_cache"):
  486.                     try:
  487.                         fn = imp.source_from_cache(fn)
  488.                     except ValueError:
  489.                         # Python 3 doesn't like orphaned but still-importable
  490.                         # .pyc files.
  491.                         fn = fn[:-1]
  492.                 else:
  493.                     fn = fn[:-1]
  494.             elif tp != imp.PY_SOURCE:
  495.                 # Don't know what this is.
  496.                 return None
  497.         else:
  498.             fn = os.path.join(pth, name.rpartition(".")[2] + ".py")
  499.  
  500.         fn_pypath = py.path.local(fn)
  501.         if not self._should_rewrite(name, fn_pypath, state):
  502.             return None
  503.  
  504.         self._rewritten_names.add(name)
  505.  
  506.         # The requested module looks like a test file, so rewrite it. This is
  507.         # the most magical part of the process: load the source, rewrite the
  508.         # asserts, and load the rewritten source. We also cache the rewritten
  509.         # module code in a special pyc. We must be aware of the possibility of
  510.         # concurrent pytest processes rewriting and loading pycs. To avoid
  511.         # tricky race conditions, we maintain the following invariant: The
  512.         # cached pyc is always a complete, valid pyc. Operations on it must be
  513.         # atomic. POSIX's atomic rename comes in handy.
  514.         write = not sys.dont_write_bytecode
  515.         cache_dir = os.path.join(fn_pypath.dirname, "__pycache__")
  516.         if write:
  517.             try:
  518.                 os.mkdir(cache_dir)
  519.             except OSError:
  520.                 e = sys.exc_info()[1].errno
  521.                 if e == errno.EEXIST:
  522.                     # Either the __pycache__ directory already exists (the
  523.                     # common case) or it's blocked by a non-dir node. In the
  524.                     # latter case, we'll ignore it in _write_pyc.
  525.                     pass
  526.                 elif e in [errno.ENOENT, errno.ENOTDIR]:
  527.                     # One of the path components was not a directory, likely
  528.                     # because we're in a zip file.
  529.                     write = False
  530.                 elif e in [errno.EACCES, errno.EROFS, errno.EPERM]:
  531.                     state.trace("read only directory: %r" % fn_pypath.dirname)
  532.                     write = False
  533.                 else:
  534.                     raise
  535.         cache_name = fn_pypath.basename[:-3] + PYC_TAIL
  536.         pyc = os.path.join(cache_dir, cache_name)
  537.         # Notice that even if we're in a read-only directory, I'm going
  538.         # to check for a cached pyc. This may not be optimal...
  539.         co = _read_pyc(fn_pypath, pyc, state.trace)
  540.         if co is None:
  541.             state.trace("rewriting %r" % (fn,))
  542.             source_stat, co = _rewrite_test(self.config, fn_pypath)
  543.             if co is None:
  544.                 # Probably a SyntaxError in the test.
  545.                 return None
  546.             if write:
  547. >               _write_pyc(state, co, source_stat, pyc)
  548.  
  549. c:\program files\python36\lib\site-packages\_pytest\assertion\rewrite.py:146:
  550. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  551.  
  552. state = <_pytest.assertion.AssertionState object at 0x00000273A3FBA400>
  553. co = <code object <module> at 0x00000273A446C030, file "c:\program files\python36\lib\test\test_file.py", line 1>
  554. source_stat = <py._path.local.Stat object at 0x00000273A4458358>
  555. pyc = 'c:\\program files\\python36\\lib\\test\\__pycache__\\test_file.cpython-36-PYTEST.pyc'
  556.  
  557.     def _write_pyc(state, co, source_stat, pyc):
  558.         # Technically, we don't have to have the same pyc format as
  559.         # (C)Python, since these "pycs" should never be seen by builtin
  560.         # import. However, there's little reason deviate, and I hope
  561.         # sometime to be able to use imp.load_compiled to load them. (See
  562.         # the comment in load_module above.)
  563.         try:
  564. >           with atomicwrites.atomic_write(pyc, mode="wb", overwrite=True) as fp:
  565.  
  566. c:\program files\python36\lib\site-packages\_pytest\assertion\rewrite.py:265:
  567. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  568.  
  569. self = <contextlib._GeneratorContextManager object at 0x00000273A445C128>
  570.  
  571.     def __enter__(self):
  572.         try:
  573. >           return next(self.gen)
  574.  
  575. c:\program files\python36\lib\contextlib.py:81:
  576. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  577.  
  578. self = <atomicwrites.AtomicWriter object at 0x00000273A445C080>
  579. get_fileobject = <bound method AtomicWriter.get_fileobject of <atomicwrites.AtomicWriter object at 0x00000273A445C080>>
  580.  
  581.     @contextlib.contextmanager
  582.     def _open(self, get_fileobject):
  583.         f = None  # make sure f exists even if get_fileobject() fails
  584.         try:
  585.             success = False
  586. >           with get_fileobject() as f:
  587.  
  588. c:\program files\python36\lib\site-packages\atomicwrites\__init__.py:149:
  589. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  590.  
  591. self = <atomicwrites.AtomicWriter object at 0x00000273A445C080>
  592. dir = 'c:\\program files\\python36\\lib\\test\\__pycache__', kwargs = {}
  593.  
  594.     def get_fileobject(self, dir=None, **kwargs):
  595.         '''Return the temporary file to use.'''
  596.         if dir is None:
  597.             dir = os.path.normpath(os.path.dirname(self._path))
  598.         return tempfile.NamedTemporaryFile(mode=self._mode, dir=dir,
  599. >                                          delete=False, **kwargs)
  600.  
  601. c:\program files\python36\lib\site-packages\atomicwrites\__init__.py:166:
  602. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  603.  
  604. mode = 'wb', buffering = -1, encoding = None, newline = None, suffix = ''
  605. prefix = 'tmp', dir = 'c:\\program files\\python36\\lib\\test\\__pycache__'
  606. delete = False
  607.  
  608.     def NamedTemporaryFile(mode='w+b', buffering=-1, encoding=None,
  609.                            newline=None, suffix=None, prefix=None,
  610.                            dir=None, delete=True):
  611.         """Create and return a temporary file.
  612.         Arguments:
  613.         'prefix', 'suffix', 'dir' -- as for mkstemp.
  614.         'mode' -- the mode argument to io.open (default "w+b").
  615.         'buffering' -- the buffer size argument to io.open (default -1).
  616.         'encoding' -- the encoding argument to io.open (default None)
  617.         'newline' -- the newline argument to io.open (default None)
  618.         'delete' -- whether the file is deleted on close (default True).
  619.         The file is created as mkstemp() would do it.
  620.  
  621.         Returns an object with a file-like interface; the name of the file
  622.         is accessible as its 'name' attribute.  The file will be automatically
  623.         deleted when it is closed unless the 'delete' argument is set to False.
  624.         """
  625.  
  626.         prefix, suffix, dir, output_type = _sanitize_params(prefix, suffix, dir)
  627.  
  628.         flags = _bin_openflags
  629.  
  630.         # Setting O_TEMPORARY in the flags causes the OS to delete
  631.         # the file when it is closed.  This is only supported by Windows.
  632.         if _os.name == 'nt' and delete:
  633.             flags |= _os.O_TEMPORARY
  634.  
  635. >       (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
  636.  
  637. c:\program files\python36\lib\tempfile.py:549:
  638. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  639.  
  640. dir = 'c:\\program files\\python36\\lib\\test\\__pycache__', pre = 'tmp'
  641. suf = '', flags = 34050, output_type = <class 'str'>
  642.  
  643.     def _mkstemp_inner(dir, pre, suf, flags, output_type):
  644.         """Code common to mkstemp, TemporaryFile, and NamedTemporaryFile."""
  645.  
  646.         names = _get_candidate_names()
  647.         if output_type is bytes:
  648.             names = map(_os.fsencode, names)
  649.  
  650.         for seq in range(TMP_MAX):
  651.             name = next(names)
  652.             file = _os.path.join(dir, pre + name + suf)
  653.             try:
  654.                 fd = _os.open(file, flags, 0o600)
  655.             except FileExistsError:
  656.                 continue    # try again
  657.             except PermissionError:
  658.                 # This exception is thrown when a directory with the chosen name
  659.                 # already exists on windows.
  660. >               if (_os.name == 'nt' and _os.path.isdir(dir) and
  661.                     _os.access(dir, _os.W_OK)):
  662. E                   KeyboardInterrupt
  663.  
  664. c:\program files\python36\lib\tempfile.py:266: KeyboardInterrupt
  665. ======================== no tests ran in 7.18 seconds =========================