File: test_gephi.py

package info (click to toggle)
pycallgraph 1.1.3-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 416 kB
  • sloc: python: 1,925; makefile: 47
file content (25 lines) | stat: -rw-r--r-- 634 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import pytest
import os

from pycallgraph2 import PyCallGraph
from pycallgraph2.output import GephiOutput
from test.calls import one_nop


@pytest.fixture
def gephi(temp):
    g = GephiOutput()
    g.output_file = temp
    return g


def test_simple(gephi):
    with PyCallGraph(output=gephi):
        one_nop()
    generated = open(gephi.output_file).read()
    os.unlink(gephi.output_file)

    assert 'nodedef> name VARCHAR' in generated
    assert 'edgedef> node1 VARCHAR, node2 VARCHAR' in generated
    assert 'test.calls.one_nop,1,true,true' in generated
    assert 'test.calls.one_nop,test.calls.nop,1,true,true' in generated