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

pyta-uoft / pyta / 12213927042

07 Dec 2024 03:10PM UTC coverage: 91.861% (-0.1%) from 91.968%
12213927042

Pull #1118

github

web-flow
Merge 395a2f890 into dbca9467f
Pull Request #1118: Fix crash when z3 is missing and add transform error reporting

6 of 12 new or added lines in 1 file covered. (50.0%)

1 existing line in 1 file now uncovered.

3104 of 3379 relevant lines covered (91.86%)

9.17 hits per line

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

66.67
/python_ta/patches/transforms.py
1
"""Patch to add transforms for setting type constraints and creating control flow graphs.
2
"""
3

4
import logging
10✔
5

6
from pylint.lint import PyLinter
10✔
7

8
from ..cfg.visitor import CFGVisitor
10✔
9

10

11
def patch_ast_transforms(z3: bool):
10✔
12
    old_get_ast = PyLinter.get_ast
10✔
13

14
    def new_get_ast(self, filepath, modname, data):
10✔
15
        ast = old_get_ast(self, filepath, modname, data)
10✔
16
        if ast is None:
10✔
17
            return None
10✔
18

19
        # Run the Z3Visitor
20
        if z3:
10✔
UNCOV
21
            try:
×
NEW
22
                from ..transforms.z3_visitor import Z3Visitor
×
23

NEW
24
                ast = Z3Visitor().visitor.visit(ast)
×
NEW
25
            except Exception as e:
×
NEW
26
                logging.warning(f"Could not run Z3Visitor: {e}")
×
27

28
        # Run the CFGVisitor
29
        try:
10✔
30
            ast.accept(CFGVisitor())
10✔
NEW
31
        except Exception as e:
×
NEW
32
            logging.warning(f"Could not run Z3Visitor: {e}")
×
33

34
        return ast
10✔
35

36
    PyLinter.get_ast = new_get_ast
10✔
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