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

uwefladrich / scriptengine / 7799909338

06 Feb 2024 12:47PM UTC coverage: 91.463% (+0.09%) from 91.371%
7799909338

Pull #108

github

uwefladrich
Update CHANGES
Pull Request #108: Fix #106: Make base.time return context

3 of 4 new or added lines in 1 file covered. (75.0%)

1907 of 2085 relevant lines covered (91.46%)

0.91 hits per line

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

52.63
/src/scriptengine/tasks/base/time.py
1
"""Time task for ScriptEngine, provides the current absolute time or elapsed
1✔
2
   time since a reference in the context.
3
"""
4

5
import datetime
1✔
6

7
from scriptengine.tasks.core import Task, timed_runner
1✔
8
from scriptengine.context import Context
1✔
9

10

11
class Time(Task):
1✔
12
    """Task class for measuring time in ScriptEngine"""
1✔
13

14
    _required_arguments = ("set",)
1✔
15

16
    def __init__(self, arguments):
1✔
17
        Time.check_arguments(arguments)
×
18
        super().__init__(arguments)
×
19

20
    @timed_runner
1✔
21
    def run(self, context):
1✔
22

23
        key = self.getarg("set", context)
×
24
        since = self.getarg("since", context, default=None)
×
25

26
        if since:
×
27
            self.log_info(f"Storing time delta in '{key}'")
×
28
        else:
29
            self.log_info(f"Storing datetime in '{key}'")
×
30

31
        now = datetime.datetime.now()
×
32

NEW
33
        return Context({key: now - since if since else now})
×
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