• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ChristianTremblay / BAC0 / 10761719058

08 Sep 2024 05:13PM UTC coverage: 38.955% (+0.04%) from 38.92%
10761719058

push

github

ChristianTremblay
Merge branch 'async' of https://github.com/ChristianTremblay/BAC0 into async

90 of 171 new or added lines in 18 files covered. (52.63%)

1008 existing lines in 18 files now uncovered.

2072 of 5319 relevant lines covered (38.95%)

0.39 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/BAC0/scripts/script_runner.py
1
import asyncio
×
2
from signal import SIGINT, SIGTERM, signal
×
3

4

5
def run(main_task, bacnet):
×
6
    global loop
7

8
    def handler(sig, sig2):
×
UNCOV
9
        if bacnet is not None:
×
10
            bacnet._log.info(f"Got signal: {sig!s}, shutting down.")
×
11
            bacnet.disconnect()
×
UNCOV
12
        loop.stop()
×
13

14
    try:
×
NEW
15
        loop = (
×
16
            asyncio.get_running_loop()
17
        )  # we also could have chosen get_event_loop(), and if we did we would not have needed to set_event_loop() and create a new event loop
UNCOV
18
    except RuntimeError:
×
UNCOV
19
        loop = asyncio.new_event_loop()
×
UNCOV
20
        asyncio.set_event_loop(loop)
×
21
    # for sig in (SIGINT, SIGTERM):
22
    #    loop.add_signal_handler(sig, handler)
UNCOV
23
    signal(SIGINT, handler)
×
24
    signal(SIGTERM, handler)
×
25

26
    loop.create_task(main_task())
×
27
    loop.run_forever()
×
28
    tasks = asyncio.all_tasks(loop=loop)
×
29
    for t in tasks:
×
30
        t.cancel()
×
31
    group = asyncio.gather(*tasks, return_exceptions=True)
×
UNCOV
32
    loop.run_until_complete(group)
×
UNCOV
33
    loop.close()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc