Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed TestException #306

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions tests/test_report_node_driver_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,27 @@

from typing import Any

import pytest

import feditest
import pytest
from feditest import nodedriver
from feditest.testplan import TestPlan, TestPlanConstellation, TestPlanConstellationNode, TestPlanSession, TestPlanTestSpec
from feditest.protocols import Node, NodeDriver
from feditest.testplan import (
TestPlan,
TestPlanConstellation,
TestPlanConstellationNode,
TestPlanSession,
TestPlanTestSpec,
)
from feditest.testrun import TestRun
from feditest.testruncontroller import AutomaticTestRunController
from feditest.testruntranscript import JsonTestRunTranscriptSerializer, SummaryTestRunTranscriptSerializer, TapTestRunTranscriptSerializer
from feditest.protocols import Node, NodeDriver
from feditest.testruntranscript import (
JsonTestRunTranscriptSerializer,
SummaryTestRunTranscriptSerializer,
TapTestRunTranscriptSerializer,
)


class TestException(Exception):
class NodeDriverTestException(Exception):
pass


Expand Down Expand Up @@ -42,7 +52,7 @@ def dummy() -> None:
@nodedriver
class Faulty_NodeDriver(NodeDriver):
def _provision_node(self, rolename: str, parameters: dict[str,Any]) -> Node:
raise TestException()
raise NodeDriverTestException()

feditest._loading_node_drivers = False

Expand All @@ -61,10 +71,7 @@ def test_faulty_node_driver_reportiung() -> None:
run = TestRun(plan)
controller = AutomaticTestRunController(run)

try:
run.run(controller)
except:
pass
run.run(controller)

transcript : feditest.testruntranscript.TestRunTranscript = run.transcribe()
# transcript.save('transcript.json')
Expand All @@ -82,4 +89,4 @@ def test_faulty_node_driver_reportiung() -> None:
json_serializer = JsonTestRunTranscriptSerializer(transcript)
j : str = json_serializer.write_to_string()
# print(j)
assert '"type": "TestException"' in j
assert f'"type": "{NodeDriverTestException.__name__}"' in j