Skip to content

Bump coverage from 5.2.1 to 5.3#1725

Merged
dependabot-preview[bot] merged 1 commit intomasterfrom
dependabot/pip/coverage-5.3
Sep 14, 2020
Merged

Bump coverage from 5.2.1 to 5.3#1725
dependabot-preview[bot] merged 1 commit intomasterfrom
dependabot/pip/coverage-5.3

Conversation

@dependabot-preview
Copy link
Copy Markdown
Contributor

@dependabot-preview dependabot-preview Bot commented Sep 14, 2020

Bumps coverage from 5.2.1 to 5.3.

Release notes

Sourced from coverage's releases.

coverage-5.3

  • The source setting has always been interpreted as either a file path or a module, depending on which existed. If both interpretations were valid, it was assumed to be a file path. The new source_pkgs setting can be used to name a package to disambiguate this case. Thanks, Thomas Grainger. Fixes issue 268.
  • If a plugin was disabled due to an exception, we used to still try to record its information, causing an exception, as reported in issue 1011. This is now fixed.
Changelog

Sourced from coverage's changelog.

Version 5.3 --- 2020-09-13

  • The source setting has always been interpreted as either a file path or a module, depending on which existed. If both interpretations were valid, it was assumed to be a file path. The new source_pkgs setting can be used to name a package to disambiguate this case. Thanks, Thomas Grainger. Fixes issue 268.
  • If a plugin was disabled due to an exception, we used to still try to record its information, causing an exception, as reported in issue 1011. This is now fixed.
Commits
  • d13594e Making a release
  • 039ef09 If a plugin is disabled, don't try to record its file tracers. #1011
  • 24eb6fd Move disable_plugin to Python
  • 987ceb9 Fix a missed exception handling for bad plugins
  • c907b2e ambigious -> ambiguous
  • 263f3e1 Docs and cleanup for source_pkgs
  • ecd6ab1 Create Way to force package even if filepath exists (#1026)
  • 39e6d1d Thomas Grainger's first commit
  • 154f528 replace confusing comment with assertion (#1028)
  • c315908 Explain a mystery
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

If all status checks pass Dependabot will automatically merge this pull request.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
  • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
  • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
  • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
  • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot dashboard:

  • Update frequency (including time of day and day of week)
  • Pull request limits (per update run and/or open at any time)
  • Automerge options (never/patch/minor, and dev/runtime dependencies)
  • Out-of-range updates (receive only lockfile updates, if desired)
  • Security updates (receive only security updates, if desired)

@dependabot-preview dependabot-preview Bot added the dependencies Pull requests that update a dependency file label Sep 14, 2020
@dependabot-preview
Copy link
Copy Markdown
Contributor Author

One of your CI runs failed on this pull request, so Dependabot won't merge it.

Dependabot will still automatically merge this pull request if you amend it and your tests pass.

@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 14, 2020

Codecov Report

Merging #1725 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1725   +/-   ##
=======================================
  Coverage   99.61%   99.61%           
=======================================
  Files         115      115           
  Lines       14445    14445           
  Branches     1106     1106           
=======================================
  Hits        14389    14389           
  Misses         41       41           
  Partials       15       15           

@pquentin
Copy link
Copy Markdown
Member

test_interactive failed on macOS 3.8, see https://github.com/python-trio/trio/pull/1725/checks?check_run_id=1111276334

2020-09-14T09:17:27.5605580Z _______________________________ test_interactive _______________________________
2020-09-14T09:17:27.5605800Z 
2020-09-14T09:17:27.5606430Z self = <trio.lowlevel.FdStream object at 0x1153ba0d0>, max_bytes = 1
2020-09-14T09:17:27.5606870Z 
2020-09-14T09:17:27.5607640Z     async def receive_some(self, max_bytes=None) -> bytes:
2020-09-14T09:17:27.5608070Z         with self._receive_conflict_detector:
2020-09-14T09:17:27.5608420Z             if max_bytes is None:
2020-09-14T09:17:27.5608740Z                 max_bytes = DEFAULT_RECEIVE_SIZE
2020-09-14T09:17:27.5609020Z             else:
2020-09-14T09:17:27.5609440Z                 if not isinstance(max_bytes, int):
2020-09-14T09:17:27.5609840Z                     raise TypeError("max_bytes must be integer >= 1")
2020-09-14T09:17:27.5610320Z                 if max_bytes < 1:
2020-09-14T09:17:27.5610710Z                     raise ValueError("max_bytes must be integer >= 1")
2020-09-14T09:17:27.5611010Z     
2020-09-14T09:17:27.5611360Z             await trio.lowlevel.checkpoint()
2020-09-14T09:17:27.5611730Z             while True:
2020-09-14T09:17:27.5611940Z                 try:
2020-09-14T09:17:27.5612400Z >                   data = os.read(self._fd_holder.fd, max_bytes)
2020-09-14T09:17:27.5613130Z E                   BlockingIOError: [Errno 35] Resource temporarily unavailable
2020-09-14T09:17:27.5613490Z 
2020-09-14T09:17:27.5614470Z ../../../../hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/trio/_unix_pipes.py:168: BlockingIOError
2020-09-14T09:17:27.5614990Z 
2020-09-14T09:17:27.5615440Z During handling of the above exception, another exception occurred:
2020-09-14T09:17:27.5615940Z 
2020-09-14T09:17:27.5616160Z deadline = 98065.03993604136
2020-09-14T09:17:27.5616340Z 
2020-09-14T09:17:27.5616570Z     @contextmanager
2020-09-14T09:17:27.5616870Z     def fail_at(deadline):
2020-09-14T09:17:27.5617530Z         """Creates a cancel scope with the given deadline, and raises an error if it
2020-09-14T09:17:27.5618090Z         is actually cancelled.
2020-09-14T09:17:27.5618350Z     
2020-09-14T09:17:27.5618680Z         This function and :func:`move_on_at` are similar in that both create a
2020-09-14T09:17:27.5619210Z         cancel scope with a given absolute deadline, and if the deadline expires
2020-09-14T09:17:27.5620070Z         then both will cause :exc:`Cancelled` to be raised within the scope. The
2020-09-14T09:17:27.5620610Z         difference is that when the :exc:`Cancelled` exception reaches
2020-09-14T09:17:27.5621550Z         :func:`move_on_at`, it's caught and discarded. When it reaches
2020-09-14T09:17:27.5622400Z         :func:`fail_at`, then it's caught and :exc:`TooSlowError` is raised in its
2020-09-14T09:17:27.5622790Z         place.
2020-09-14T09:17:27.5622980Z     
2020-09-14T09:17:27.5623170Z         Raises:
2020-09-14T09:17:27.5623650Z           TooSlowError: if a :exc:`Cancelled` exception is raised in this scope
2020-09-14T09:17:27.5624130Z             and caught by the context manager.
2020-09-14T09:17:27.5624400Z     
2020-09-14T09:17:27.5624580Z         """
2020-09-14T09:17:27.5624760Z     
2020-09-14T09:17:27.5625010Z         with move_on_at(deadline) as scope:
2020-09-14T09:17:27.5625300Z >           yield scope
2020-09-14T09:17:27.5625470Z 
2020-09-14T09:17:27.5626330Z ../../../../hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/trio/_timeouts.py:105: 
2020-09-14T09:17:27.5627050Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2020-09-14T09:17:27.5627240Z 
2020-09-14T09:17:27.5627510Z     async def test_interactive():
2020-09-14T09:17:27.5628360Z         # Test some back-and-forth with a subprocess. This one works like so:
2020-09-14T09:17:27.5628770Z         # in: 32\n
2020-09-14T09:17:27.5629000Z         # out: 0000...0000\n (32 zeroes)
2020-09-14T09:17:27.5629440Z         # err: 1111...1111\n (64 ones)
2020-09-14T09:17:27.5629640Z         # in: 10\n
2020-09-14T09:17:27.5629860Z         # out: 2222222222\n (10 twos)
2020-09-14T09:17:27.5630110Z         # err: 3333....3333\n (20 threes)
2020-09-14T09:17:27.5630330Z         # in: EOF
2020-09-14T09:17:27.5630540Z         # out: EOF
2020-09-14T09:17:27.5630760Z         # err: EOF
2020-09-14T09:17:27.5630950Z     
2020-09-14T09:17:27.5631200Z         async with await open_process(
2020-09-14T09:17:27.5631470Z             python(
2020-09-14T09:17:27.5631690Z                 "idx = 0\n"
2020-09-14T09:17:27.5631920Z                 "while True:\n"
2020-09-14T09:17:27.5632250Z                 "    line = sys.stdin.readline()\n"
2020-09-14T09:17:27.5632980Z                 "    if line == '': break\n"
2020-09-14T09:17:27.5633290Z                 "    request = int(line.strip())\n"
2020-09-14T09:17:27.5633610Z                 "    print(str(idx * 2) * request)\n"
2020-09-14T09:17:27.5633970Z                 "    print(str(idx * 2 + 1) * request * 2, file=sys.stderr)\n"
2020-09-14T09:17:27.5634290Z                 "    idx += 1\n"
2020-09-14T09:17:27.5634490Z             ),
2020-09-14T09:17:27.5634760Z             stdin=subprocess.PIPE,
2020-09-14T09:17:27.5635130Z             stdout=subprocess.PIPE,
2020-09-14T09:17:27.5635510Z             stderr=subprocess.PIPE,
2020-09-14T09:17:27.5635800Z         ) as proc:
2020-09-14T09:17:27.5636000Z     
2020-09-14T09:17:27.5636240Z             newline = b"\n" if posix else b"\r\n"
2020-09-14T09:17:27.5636480Z     
2020-09-14T09:17:27.5636740Z             async def expect(idx, request):
2020-09-14T09:17:27.5637120Z                 async with _core.open_nursery() as nursery:
2020-09-14T09:17:27.5637410Z     
2020-09-14T09:17:27.5637700Z                     async def drain_one(stream, count, digit):
2020-09-14T09:17:27.5638030Z                         while count > 0:
2020-09-14T09:17:27.5638380Z                             result = await stream.receive_some(count)
2020-09-14T09:17:27.5638740Z                             assert result == (
2020-09-14T09:17:27.5639480Z                                 "{}".format(digit).encode("utf-8") * len(result)
2020-09-14T09:17:27.5639790Z                             )
2020-09-14T09:17:27.5640370Z                             count -= len(result)
2020-09-14T09:17:27.5640660Z                         assert count == 0
2020-09-14T09:17:27.5641060Z                         assert await stream.receive_some(len(newline)) == newline
2020-09-14T09:17:27.5641400Z     
2020-09-14T09:17:27.5641910Z                     nursery.start_soon(drain_one, proc.stdout, request, idx * 2)
2020-09-14T09:17:27.5642480Z                     nursery.start_soon(drain_one, proc.stderr, request * 2, idx * 2 + 1)
2020-09-14T09:17:27.5642960Z     
2020-09-14T09:17:27.5643180Z             with fail_after(5):
2020-09-14T09:17:27.5643570Z                 await proc.stdin.send_all(b"12")
2020-09-14T09:17:27.5643880Z                 await sleep(0.1)
2020-09-14T09:17:27.5644220Z                 await proc.stdin.send_all(b"345" + newline)
2020-09-14T09:17:27.5644570Z                 await expect(0, 12345)
2020-09-14T09:17:27.5644940Z                 await proc.stdin.send_all(b"100" + newline + b"200" + newline)
2020-09-14T09:17:27.5645310Z                 await expect(1, 100)
2020-09-14T09:17:27.5645560Z                 await expect(2, 200)
2020-09-14T09:17:27.5645900Z                 await proc.stdin.send_all(b"0" + newline)
2020-09-14T09:17:27.5646240Z                 await expect(3, 0)
2020-09-14T09:17:27.5646560Z                 await proc.stdin.send_all(b"999999")
2020-09-14T09:17:27.5646910Z                 with move_on_after(0.1) as scope:
2020-09-14T09:17:27.5647420Z                     await expect(4, 0)
2020-09-14T09:17:27.5647800Z                 assert scope.cancelled_caught
2020-09-14T09:17:27.5648200Z                 await proc.stdin.send_all(newline)
2020-09-14T09:17:27.5648530Z                 await expect(4, 999999)
2020-09-14T09:17:27.5648860Z                 await proc.stdin.aclose()
2020-09-14T09:17:27.5649440Z >               assert await proc.stdout.receive_some(1) == b""
2020-09-14T09:17:27.5649730Z 
2020-09-14T09:17:27.5650690Z ../../../../hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/trio/tests/test_subprocess.py:210: 
2020-09-14T09:17:27.5651190Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2020-09-14T09:17:27.5651350Z 
2020-09-14T09:17:27.5651730Z self = <trio.lowlevel.FdStream object at 0x1153ba0d0>, max_bytes = 1
2020-09-14T09:17:27.5652130Z 
2020-09-14T09:17:27.5652790Z     async def receive_some(self, max_bytes=None) -> bytes:
2020-09-14T09:17:27.5653310Z         with self._receive_conflict_detector:
2020-09-14T09:17:27.5653640Z             if max_bytes is None:
2020-09-14T09:17:27.5653960Z                 max_bytes = DEFAULT_RECEIVE_SIZE
2020-09-14T09:17:27.5654240Z             else:
2020-09-14T09:17:27.5654510Z                 if not isinstance(max_bytes, int):
2020-09-14T09:17:27.5654900Z                     raise TypeError("max_bytes must be integer >= 1")
2020-09-14T09:17:27.5655240Z                 if max_bytes < 1:
2020-09-14T09:17:27.5655580Z                     raise ValueError("max_bytes must be integer >= 1")
2020-09-14T09:17:27.5655880Z     
2020-09-14T09:17:27.5656220Z             await trio.lowlevel.checkpoint()
2020-09-14T09:17:27.5656590Z             while True:
2020-09-14T09:17:27.5656820Z                 try:
2020-09-14T09:17:27.5657120Z                     data = os.read(self._fd_holder.fd, max_bytes)
2020-09-14T09:17:27.5657520Z                 except BlockingIOError:
2020-09-14T09:17:27.5657980Z >                   await trio.lowlevel.wait_readable(self._fd_holder.fd)
2020-09-14T09:17:27.5658320Z 
2020-09-14T09:17:27.5659170Z ../../../../hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/trio/_unix_pipes.py:170: 
2020-09-14T09:17:27.5659630Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2020-09-14T09:17:27.5659780Z 
2020-09-14T09:17:27.5659960Z fd = 32
2020-09-14T09:17:27.5660110Z 
2020-09-14T09:17:27.5660350Z     async def wait_readable(fd):
2020-09-14T09:17:27.5660730Z         locals()[LOCALS_KEY_KI_PROTECTION_ENABLED] = True
2020-09-14T09:17:27.5661050Z         try:
2020-09-14T09:17:27.5661460Z >           return await GLOBAL_RUN_CONTEXT.runner.io_manager.wait_readable(fd)
2020-09-14T09:17:27.5661830Z 
2020-09-14T09:17:27.5662690Z ../../../../hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/trio/_core/_generated_io_kqueue.py:38: 
2020-09-14T09:17:27.5663190Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2020-09-14T09:17:27.5663350Z 
2020-09-14T09:17:27.5664130Z self = KqueueIOManager(_kqueue=<select.kqueue object at 0x114ecc4d0>, _registered={}, _force_wakeup=<trio._core._wakeup_socketpair.WakeupSocketpair object at 0x11323f0d0>, _force_wakeup_fd=18)
2020-09-14T09:17:27.5664940Z fd = 32
2020-09-14T09:17:27.5665080Z 
2020-09-14T09:17:27.5665280Z     @_public
2020-09-14T09:17:27.5665560Z     async def wait_readable(self, fd):
2020-09-14T09:17:27.5665960Z >       await self._wait_common(fd, select.KQ_FILTER_READ)
2020-09-14T09:17:27.5666230Z 
2020-09-14T09:17:27.5667060Z ../../../../hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/trio/_core/_io_kqueue.py:167: 
2020-09-14T09:17:27.5667630Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2020-09-14T09:17:27.5667780Z 
2020-09-14T09:17:27.5668560Z self = KqueueIOManager(_kqueue=<select.kqueue object at 0x114ecc4d0>, _registered={}, _force_wakeup=<trio._core._wakeup_socketpair.WakeupSocketpair object at 0x11323f0d0>, _force_wakeup_fd=18)
2020-09-14T09:17:27.5669720Z fd = 32, filter = -1
2020-09-14T09:17:27.5670140Z 
2020-09-14T09:17:27.5670460Z     async def _wait_common(self, fd, filter):
2020-09-14T09:17:27.5670790Z         if not isinstance(fd, int):
2020-09-14T09:17:27.5671080Z             fd = fd.fileno()
2020-09-14T09:17:27.5671420Z         flags = select.KQ_EV_ADD | select.KQ_EV_ONESHOT
2020-09-14T09:17:27.5671840Z         event = select.kevent(fd, filter, flags)
2020-09-14T09:17:27.5672390Z         self._kqueue.control([event], 0)
2020-09-14T09:17:27.5672660Z     
2020-09-14T09:17:27.5672870Z         def abort(_):
2020-09-14T09:17:27.5673300Z             event = select.kevent(fd, filter, select.KQ_EV_DELETE)
2020-09-14T09:17:27.5673660Z             try:
2020-09-14T09:17:27.5673940Z                 self._kqueue.control([event], 0)
2020-09-14T09:17:27.5674370Z             except OSError as exc:
2020-09-14T09:17:27.5674820Z                 # kqueue tracks individual fds (*not* the underlying file
2020-09-14T09:17:27.5675320Z                 # object, see _io_epoll.py for a long discussion of why this
2020-09-14T09:17:27.5675850Z                 # distinction matters), and automatically deregisters an event
2020-09-14T09:17:27.5676390Z                 # if the fd is closed. So if kqueue.control says that it
2020-09-14T09:17:27.5677310Z                 # doesn't know about this event, then probably it's because
2020-09-14T09:17:27.5678140Z                 # the fd was closed behind our backs. (Too bad we can't ask it
2020-09-14T09:17:27.5678630Z                 # to wake us up when this happens, versus discovering it after
2020-09-14T09:17:27.5679430Z                 # the fact... oh well, you can't have everything.)
2020-09-14T09:17:27.5679740Z                 #
2020-09-14T09:17:27.5680340Z                 # FreeBSD reports this using EBADF. macOS uses ENOENT.
2020-09-14T09:17:27.5680850Z                 if exc.errno in (errno.EBADF, errno.ENOENT):  # pragma: no branch
2020-09-14T09:17:27.5681240Z                     pass
2020-09-14T09:17:27.5681490Z                 else:  # pragma: no cover
2020-09-14T09:17:27.5682310Z                     # As far as we know, this branch can't happen.
2020-09-14T09:17:27.5682630Z                     raise
2020-09-14T09:17:27.5682960Z             return _core.Abort.SUCCEEDED
2020-09-14T09:17:27.5683260Z     
2020-09-14T09:17:27.5683540Z >       await self.wait_kevent(fd, filter, abort)
2020-09-14T09:17:27.5683810Z 
2020-09-14T09:17:27.5684640Z ../../../../hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/trio/_core/_io_kqueue.py:163: 
2020-09-14T09:17:27.5685110Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2020-09-14T09:17:27.5685260Z 
2020-09-14T09:17:27.5686040Z self = KqueueIOManager(_kqueue=<select.kqueue object at 0x114ecc4d0>, _registered={}, _force_wakeup=<trio._core._wakeup_socketpair.WakeupSocketpair object at 0x11323f0d0>, _force_wakeup_fd=18)
2020-09-14T09:17:27.5687190Z ident = 32, filter = -1
2020-09-14T09:17:27.5687650Z abort_func = <function KqueueIOManager._wait_common.<locals>.abort at 0x114eb1430>
2020-09-14T09:17:27.5688020Z 
2020-09-14T09:17:27.5688220Z     @_public
2020-09-14T09:17:27.5688550Z     async def wait_kevent(self, ident, filter, abort_func):
2020-09-14T09:17:27.5688910Z         key = (ident, filter)
2020-09-14T09:17:27.5689210Z         if key in self._registered:
2020-09-14T09:17:27.5689610Z             raise _core.BusyResourceError(
2020-09-14T09:17:27.5690130Z                 "attempt to register multiple listeners for same ident/filter pair"
2020-09-14T09:17:27.5690500Z             )
2020-09-14T09:17:27.5690800Z         self._registered[key] = _core.current_task()
2020-09-14T09:17:27.5691110Z     
2020-09-14T09:17:27.5691340Z         def abort(raise_cancel):
2020-09-14T09:17:27.5691640Z             r = abort_func(raise_cancel)
2020-09-14T09:17:27.5692010Z             if r is _core.Abort.SUCCEEDED:
2020-09-14T09:17:27.5692390Z                 del self._registered[key]
2020-09-14T09:17:27.5692660Z             return r
2020-09-14T09:17:27.5692860Z     
2020-09-14T09:17:27.5693430Z >       return await _core.wait_task_rescheduled(abort)
2020-09-14T09:17:27.5693750Z 
2020-09-14T09:17:27.5694630Z ../../../../hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/trio/_core/_io_kqueue.py:132: 
2020-09-14T09:17:27.5695100Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2020-09-14T09:17:27.5695450Z 
2020-09-14T09:17:27.5695960Z abort_func = <function KqueueIOManager.wait_kevent.<locals>.abort at 0x11542b160>
2020-09-14T09:17:27.5696350Z 
2020-09-14T09:17:27.5696650Z     async def wait_task_rescheduled(abort_func):
2020-09-14T09:17:27.5697110Z         """Put the current task to sleep, with cancellation support.
2020-09-14T09:17:27.5697450Z     
2020-09-14T09:17:27.5698210Z         This is the lowest-level API for blocking in Trio. Every time a
2020-09-14T09:17:27.5698790Z         :class:`~trio.lowlevel.Task` blocks, it does so by calling this function
2020-09-14T09:17:27.5699670Z         (usually indirectly via some higher-level API).
2020-09-14T09:17:27.5699990Z     
2020-09-14T09:17:27.5700320Z         This is a tricky interface with no guard rails. If you can use
2020-09-14T09:17:27.5701320Z         :class:`ParkingLot` or the built-in I/O wait functions instead, then you
2020-09-14T09:17:27.5701740Z         should.
2020-09-14T09:17:27.5701940Z     
2020-09-14T09:17:27.5702300Z         Generally the way it works is that before calling this function, you make
2020-09-14T09:17:27.5702880Z         arrangements for "someone" to call :func:`reschedule` on the current task
2020-09-14T09:17:27.5703380Z         at some later point.
2020-09-14T09:17:27.5703600Z     
2020-09-14T09:17:27.5703950Z         Then you call :func:`wait_task_rescheduled`, passing in ``abort_func``, an
2020-09-14T09:17:27.5704350Z         "abort callback".
2020-09-14T09:17:27.5704580Z     
2020-09-14T09:17:27.5704930Z         (Terminology: in Trio, "aborting" is the process of attempting to
2020-09-14T09:17:27.5705450Z         interrupt a blocked task to deliver a cancellation.)
2020-09-14T09:17:27.5705800Z     
2020-09-14T09:17:27.5706250Z         There are two possibilities for what happens next:
2020-09-14T09:17:27.5706570Z     
2020-09-14T09:17:27.5706960Z         1. "Someone" calls :func:`reschedule` on the current task, and
2020-09-14T09:17:27.5707480Z            :func:`wait_task_rescheduled` returns or raises whatever value or error
2020-09-14T09:17:27.5707950Z            was passed to :func:`reschedule`.
2020-09-14T09:17:27.5708210Z     
2020-09-14T09:17:27.5708990Z         2. The call's context transitions to a cancelled state (e.g. due to a
2020-09-14T09:17:27.5709530Z            timeout expiring). When this happens, the ``abort_func`` is called. Its
2020-09-14T09:17:27.5709970Z            interface looks like::
2020-09-14T09:17:27.5710460Z     
2020-09-14T09:17:27.5710700Z                def abort_func(raise_cancel):
2020-09-14T09:17:27.5710960Z                    ...
2020-09-14T09:17:27.5711400Z                    return trio.lowlevel.Abort.SUCCEEDED  # or FAILED
2020-09-14T09:17:27.5711830Z     
2020-09-14T09:17:27.5712200Z            It should attempt to clean up any state associated with this call, and
2020-09-14T09:17:27.5712730Z            in particular, arrange that :func:`reschedule` will *not* be called
2020-09-14T09:17:27.5713250Z            later. If (and only if!) it is successful, then it should return
2020-09-14T09:17:27.5713800Z            :data:`Abort.SUCCEEDED`, in which case the task will automatically be
2020-09-14T09:17:27.5714380Z            rescheduled with an appropriate :exc:`~trio.Cancelled` error.
2020-09-14T09:17:27.5714760Z     
2020-09-14T09:17:27.5715130Z            Otherwise, it should return :data:`Abort.FAILED`. This means that the
2020-09-14T09:17:27.5716150Z            task can't be cancelled at this time, and still has to make sure that
2020-09-14T09:17:27.5716650Z            "someone" eventually calls :func:`reschedule`.
2020-09-14T09:17:27.5716960Z     
2020-09-14T09:17:27.5717330Z            At that point there are again two possibilities. You can simply ignore
2020-09-14T09:17:27.5718180Z            the cancellation altogether: wait for the operation to complete and
2020-09-14T09:17:27.5718780Z            then reschedule and continue as normal. (For example, this is what
2020-09-14T09:17:27.5719320Z            :func:`trio.to_thread.run_sync` does if cancellation is disabled.)
2020-09-14T09:17:27.5720010Z            The other possibility is that the ``abort_func`` does succeed in
2020-09-14T09:17:27.5720970Z            cancelling the operation, but for some reason isn't able to report that
2020-09-14T09:17:27.5721870Z            right away. (Example: on Windows, it's possible to request that an
2020-09-14T09:17:27.5722420Z            async ("overlapped") I/O operation be cancelled, but this request is
2020-09-14T09:17:27.5723300Z            *also* asynchronous – you don't find out until later whether the
2020-09-14T09:17:27.5723820Z            operation was actually cancelled or not.)  To report a delayed
2020-09-14T09:17:27.5724440Z            cancellation, then you should reschedule the task yourself, and call
2020-09-14T09:17:27.5724980Z            the ``raise_cancel`` callback passed to ``abort_func`` to raise a
2020-09-14T09:17:27.5725550Z            :exc:`~trio.Cancelled` (or possibly :exc:`KeyboardInterrupt`) exception
2020-09-14T09:17:27.5726150Z            into this task. Either of the approaches sketched below can work::
2020-09-14T09:17:27.5726530Z     
2020-09-14T09:17:27.5726740Z               # Option 1:
2020-09-14T09:17:27.5727110Z               # Catch the exception from raise_cancel and inject it into the task.
2020-09-14T09:17:27.5727610Z               # (This is what Trio does automatically for you if you return
2020-09-14T09:17:27.5728030Z               # Abort.SUCCEEDED.)
2020-09-14T09:17:27.5728560Z               trio.lowlevel.reschedule(task, outcome.capture(raise_cancel))
2020-09-14T09:17:27.5729010Z     
2020-09-14T09:17:27.5729220Z               # Option 2:
2020-09-14T09:17:27.5729560Z               # wait to be woken by "someone", and then decide whether to raise
2020-09-14T09:17:27.5729970Z               # the error from inside the task.
2020-09-14T09:17:27.5730290Z               outer_raise_cancel = None
2020-09-14T09:17:27.5730610Z               def abort(inner_raise_cancel):
2020-09-14T09:17:27.5730940Z                   nonlocal outer_raise_cancel
2020-09-14T09:17:27.5731310Z                   outer_raise_cancel = inner_raise_cancel
2020-09-14T09:17:27.5731780Z                   TRY_TO_CANCEL_OPERATION()
2020-09-14T09:17:27.5732240Z                   return trio.lowlevel.Abort.FAILED
2020-09-14T09:17:27.5732700Z               await wait_task_rescheduled(abort)
2020-09-14T09:17:27.5733170Z               if OPERATION_WAS_SUCCESSFULLY_CANCELLED:
2020-09-14T09:17:27.5733550Z                   # raises the error
2020-09-14T09:17:27.5733840Z                   outer_raise_cancel()
2020-09-14T09:17:27.5734070Z     
2020-09-14T09:17:27.5734880Z            In any case it's guaranteed that we only call the ``abort_func`` at most
2020-09-14T09:17:27.5735370Z            once per call to :func:`wait_task_rescheduled`.
2020-09-14T09:17:27.5735660Z     
2020-09-14T09:17:27.5736390Z         Sometimes, it's useful to be able to share some mutable sleep-related data
2020-09-14T09:17:27.5736980Z         between the sleeping task, the abort function, and the waking task. You
2020-09-14T09:17:27.5737900Z         can use the sleeping task's :data:`~Task.custom_sleep_data` attribute to
2020-09-14T09:17:27.5738780Z         store this data, and Trio won't touch it, except to make sure that it gets
2020-09-14T09:17:27.5739260Z         cleared when the task is rescheduled.
2020-09-14T09:17:27.5739540Z     
2020-09-14T09:17:27.5739760Z         .. warning::
2020-09-14T09:17:27.5739970Z     
2020-09-14T09:17:27.5740290Z            If your ``abort_func`` raises an error, or returns any value other than
2020-09-14T09:17:27.5740840Z            :data:`Abort.SUCCEEDED` or :data:`Abort.FAILED`, then Trio will crash
2020-09-14T09:17:27.5741700Z            violently. Be careful! Similarly, it is entirely possible to deadlock a
2020-09-14T09:17:27.5742330Z            Trio program by failing to reschedule a blocked task, or cause havoc by
2020-09-14T09:17:27.5742870Z            calling :func:`reschedule` too many times. Remember what we said up
2020-09-14T09:17:27.5743830Z            above about how you should use a higher-level API if at all possible?
2020-09-14T09:17:27.5744390Z     
2020-09-14T09:17:27.5744580Z         """
2020-09-14T09:17:27.5744980Z >       return (await _async_yield(WaitTaskRescheduled(abort_func))).unwrap()
2020-09-14T09:17:27.5745340Z 
2020-09-14T09:17:27.5746190Z ../../../../hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/trio/_core/_traps.py:166: 
2020-09-14T09:17:27.5746660Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2020-09-14T09:17:27.5746820Z 
2020-09-14T09:17:27.5747060Z self = Error(Cancelled())
2020-09-14T09:17:27.5747260Z 
2020-09-14T09:17:27.5747480Z     def unwrap(self):
2020-09-14T09:17:27.5747750Z         self._set_unwrapped()
2020-09-14T09:17:27.5748510Z         # Tracebacks show the 'raise' line below out of context, so let's give
2020-09-14T09:17:27.5749010Z         # this variable a name that makes sense out of context.
2020-09-14T09:17:27.5749410Z         captured_error = self.error
2020-09-14T09:17:27.5749730Z >       raise captured_error
2020-09-14T09:17:27.5749930Z 
2020-09-14T09:17:27.5750720Z ../../../../hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/outcome/_sync.py:111: 
2020-09-14T09:17:27.5751180Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2020-09-14T09:17:27.5751350Z 
2020-09-14T09:17:27.5751560Z     def raise_cancel():
2020-09-14T09:17:27.5751850Z >       raise Cancelled._create()
2020-09-14T09:17:27.5752190Z E       trio.Cancelled: Cancelled
2020-09-14T09:17:27.5752430Z 
2020-09-14T09:17:27.5753260Z ../../../../hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/trio/_core/_run.py:1167: Cancelled
2020-09-14T09:17:27.5753670Z 
2020-09-14T09:17:27.5754060Z During handling of the above exception, another exception occurred:
2020-09-14T09:17:27.5754390Z 
2020-09-14T09:17:27.5754650Z     async def test_interactive():
2020-09-14T09:17:27.5755450Z         # Test some back-and-forth with a subprocess. This one works like so:
2020-09-14T09:17:27.5755930Z         # in: 32\n
2020-09-14T09:17:27.5756180Z         # out: 0000...0000\n (32 zeroes)
2020-09-14T09:17:27.5756430Z         # err: 1111...1111\n (64 ones)
2020-09-14T09:17:27.5756640Z         # in: 10\n
2020-09-14T09:17:27.5756860Z         # out: 2222222222\n (10 twos)
2020-09-14T09:17:27.5757100Z         # err: 3333....3333\n (20 threes)
2020-09-14T09:17:27.5757330Z         # in: EOF
2020-09-14T09:17:27.5757540Z         # out: EOF
2020-09-14T09:17:27.5757750Z         # err: EOF
2020-09-14T09:17:27.5757940Z     
2020-09-14T09:17:27.5758200Z         async with await open_process(
2020-09-14T09:17:27.5758480Z             python(
2020-09-14T09:17:27.5758690Z                 "idx = 0\n"
2020-09-14T09:17:27.5758920Z                 "while True:\n"
2020-09-14T09:17:27.5759240Z                 "    line = sys.stdin.readline()\n"
2020-09-14T09:17:27.5759950Z                 "    if line == '': break\n"
2020-09-14T09:17:27.5760270Z                 "    request = int(line.strip())\n"
2020-09-14T09:17:27.5760590Z                 "    print(str(idx * 2) * request)\n"
2020-09-14T09:17:27.5760960Z                 "    print(str(idx * 2 + 1) * request * 2, file=sys.stderr)\n"
2020-09-14T09:17:27.5761270Z                 "    idx += 1\n"
2020-09-14T09:17:27.5761460Z             ),
2020-09-14T09:17:27.5761740Z             stdin=subprocess.PIPE,
2020-09-14T09:17:27.5762110Z             stdout=subprocess.PIPE,
2020-09-14T09:17:27.5762490Z             stderr=subprocess.PIPE,
2020-09-14T09:17:27.5762780Z         ) as proc:
2020-09-14T09:17:27.5762980Z     
2020-09-14T09:17:27.5763290Z             newline = b"\n" if posix else b"\r\n"
2020-09-14T09:17:27.5763540Z     
2020-09-14T09:17:27.5764150Z             async def expect(idx, request):
2020-09-14T09:17:27.5764580Z                 async with _core.open_nursery() as nursery:
2020-09-14T09:17:27.5764870Z     
2020-09-14T09:17:27.5765160Z                     async def drain_one(stream, count, digit):
2020-09-14T09:17:27.5765490Z                         while count > 0:
2020-09-14T09:17:27.5766010Z                             result = await stream.receive_some(count)
2020-09-14T09:17:27.5766380Z                             assert result == (
2020-09-14T09:17:27.5767150Z                                 "{}".format(digit).encode("utf-8") * len(result)
2020-09-14T09:17:27.5767470Z                             )
2020-09-14T09:17:27.5768050Z                             count -= len(result)
2020-09-14T09:17:27.5768340Z                         assert count == 0
2020-09-14T09:17:27.5769450Z                         assert await stream.receive_some(len(newline)) == newline
2020-09-14T09:17:27.5769900Z     
2020-09-14T09:17:27.5770320Z                     nursery.start_soon(drain_one, proc.stdout, request, idx * 2)
2020-09-14T09:17:27.5771230Z                     nursery.start_soon(drain_one, proc.stderr, request * 2, idx * 2 + 1)
2020-09-14T09:17:27.5771610Z     
2020-09-14T09:17:27.5771820Z             with fail_after(5):
2020-09-14T09:17:27.5772150Z                 await proc.stdin.send_all(b"12")
2020-09-14T09:17:27.5772650Z                 await sleep(0.1)
2020-09-14T09:17:27.5772990Z                 await proc.stdin.send_all(b"345" + newline)
2020-09-14T09:17:27.5773340Z                 await expect(0, 12345)
2020-09-14T09:17:27.5773710Z                 await proc.stdin.send_all(b"100" + newline + b"200" + newline)
2020-09-14T09:17:27.5774090Z                 await expect(1, 100)
2020-09-14T09:17:27.5774350Z                 await expect(2, 200)
2020-09-14T09:17:27.5774680Z                 await proc.stdin.send_all(b"0" + newline)
2020-09-14T09:17:27.5775130Z                 await expect(3, 0)
2020-09-14T09:17:27.5775450Z                 await proc.stdin.send_all(b"999999")
2020-09-14T09:17:27.5775800Z                 with move_on_after(0.1) as scope:
2020-09-14T09:17:27.5776090Z                     await expect(4, 0)
2020-09-14T09:17:27.5776420Z                 assert scope.cancelled_caught
2020-09-14T09:17:27.5776830Z                 await proc.stdin.send_all(newline)
2020-09-14T09:17:27.5777170Z                 await expect(4, 999999)
2020-09-14T09:17:27.5777490Z                 await proc.stdin.aclose()
2020-09-14T09:17:27.5777910Z >               assert await proc.stdout.receive_some(1) == b""
2020-09-14T09:17:27.5778210Z 
2020-09-14T09:17:27.5779310Z ../../../../hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/trio/tests/test_subprocess.py:210: 
2020-09-14T09:17:27.5779820Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2020-09-14T09:17:27.5780230Z ../../../../hostedtoolcache/Python/3.8.5/x64/lib/python3.8/contextlib.py:131: in __exit__
2020-09-14T09:17:27.5780850Z     self.gen.throw(type, value, traceback)
2020-09-14T09:17:27.5781180Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
2020-09-14T09:17:27.5781350Z 
2020-09-14T09:17:27.5781560Z deadline = 98065.03993604136
2020-09-14T09:17:27.5781720Z 
2020-09-14T09:17:27.5781960Z     @contextmanager
2020-09-14T09:17:27.5782260Z     def fail_at(deadline):
2020-09-14T09:17:27.5782670Z         """Creates a cancel scope with the given deadline, and raises an error if it
2020-09-14T09:17:27.5783110Z         is actually cancelled.
2020-09-14T09:17:27.5783360Z     
2020-09-14T09:17:27.5783700Z         This function and :func:`move_on_at` are similar in that both create a
2020-09-14T09:17:27.5784240Z         cancel scope with a given absolute deadline, and if the deadline expires
2020-09-14T09:17:27.5784780Z         then both will cause :exc:`Cancelled` to be raised within the scope. The
2020-09-14T09:17:27.5785310Z         difference is that when the :exc:`Cancelled` exception reaches
2020-09-14T09:17:27.5786480Z         :func:`move_on_at`, it's caught and discarded. When it reaches
2020-09-14T09:17:27.5787430Z         :func:`fail_at`, then it's caught and :exc:`TooSlowError` is raised in its
2020-09-14T09:17:27.5787810Z         place.
2020-09-14T09:17:27.5788010Z     
2020-09-14T09:17:27.5788200Z         Raises:
2020-09-14T09:17:27.5788600Z           TooSlowError: if a :exc:`Cancelled` exception is raised in this scope
2020-09-14T09:17:27.5789270Z             and caught by the context manager.
2020-09-14T09:17:27.5789540Z     
2020-09-14T09:17:27.5789720Z         """
2020-09-14T09:17:27.5789900Z     
2020-09-14T09:17:27.5790160Z         with move_on_at(deadline) as scope:
2020-09-14T09:17:27.5790450Z             yield scope
2020-09-14T09:17:27.5790750Z         if scope.cancelled_caught:
2020-09-14T09:17:27.5791090Z >           raise TooSlowError
2020-09-14T09:17:27.5791420Z E           trio.TooSlowError

@pquentin pquentin closed this Sep 14, 2020
@dependabot-preview
Copy link
Copy Markdown
Contributor Author

OK, I won't notify you again about this release, but will get in touch when a new version is available. If you'd rather skip all updates until the next major or minor version, let me know by commenting @dependabot ignore this major version or @dependabot ignore this minor version.

If you change your mind, just re-open this PR and I'll resolve any conflicts on it.

@pquentin pquentin reopened this Sep 14, 2020
Bumps [coverage](https://github.com/nedbat/coveragepy) from 5.2.1 to 5.3.
- [Release notes](https://github.com/nedbat/coveragepy/releases)
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst)
- [Commits](coveragepy/coveragepy@coverage-5.2.1...coverage-5.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
@dependabot-preview dependabot-preview Bot force-pushed the dependabot/pip/coverage-5.3 branch from 3828501 to 7934169 Compare September 14, 2020 09:29
@dependabot-preview dependabot-preview Bot merged commit c69944f into master Sep 14, 2020
@dependabot-preview dependabot-preview Bot deleted the dependabot/pip/coverage-5.3 branch September 14, 2020 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant