Skip to content

Commit 22db840

Browse files
author
Ryan Faircloth
authored
Merge pull request #368 from splunk/remove-recordtype-library
remove recordtype library
2 parents f02fba4 + a001621 commit 22db840

File tree

4 files changed

+22
-34
lines changed

4 files changed

+22
-34
lines changed

poetry.lock

Lines changed: 1 addition & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ lovely-pytest-docker = "*"
4242
pytest-mock = "^3.5.1"
4343
pytest-cov = "^2.11.1"
4444
requests-mock = "^1.8.0"
45-
recordtype = "^1.3"
4645
freezegun = "^1.1.0"
4746

4847
[tool.poetry.plugins]

tests/unit/tests_standard_lib/test_event_ingestors/conftest.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import pytest
2-
from recordtype import recordtype
2+
from dataclasses import dataclass
33
from .test_hec_event_metric_raw_ingestor import HEC_URI
44

5-
SampleEvent = recordtype(
6-
"SampleEvent",
7-
["event", "metadata", "sample_name", ("key_fields", None), ("time_values", None)],
8-
)
5+
6+
@dataclass()
7+
class SampleEvent:
8+
event: str
9+
metadata: dict
10+
sample_name: str
11+
key_fields: dict = None
12+
time_values: list = None
913

1014

1115
@pytest.fixture()

tests/unit/tests_standard_lib/test_event_ingestors/test_requirement_event_ingestor.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
import pytest
22
from unittest.mock import MagicMock, call, patch
3-
from recordtype import recordtype
3+
from dataclasses import dataclass
44
from pytest_splunk_addon.standard_lib.event_ingestors.requirement_event_ingester import (
55
RequirementEventIngestor,
66
ET,
77
)
88

99

1010
module = "pytest_splunk_addon.standard_lib.event_ingestors.requirement_event_ingester"
11-
sample_event = recordtype(
12-
"SampleEvent",
13-
["event", "metadata", "sample_name", ("key_fields", None), ("time_values", None)],
14-
)
1511

1612

17-
@pytest.fixture()
18-
def sample_event_mock(monkeypatch):
19-
monkeypatch.setattr(f"{module}.SampleEvent", sample_event)
13+
@dataclass()
14+
class SampleEvent:
15+
event: str
16+
metadata: dict
17+
sample_name: str
18+
key_fields: dict = None
19+
time_values: list = None
2020

2121

2222
@pytest.fixture()
23-
def src_regex_mock(monkeypatch):
24-
monkeypatch.setattr(f"{module}.SrcRegex", src_regex)
23+
def sample_event_mock(monkeypatch):
24+
monkeypatch.setattr(f"{module}.SampleEvent", SampleEvent)
2525

2626

2727
@pytest.fixture()
@@ -116,12 +116,12 @@ def test_events_can_be_obtained(
116116
mock_object("os.listdir", return_value=["sample.log"])
117117
req = RequirementEventIngestor("fake_path")
118118
assert req.get_events() == [
119-
sample_event(
119+
SampleEvent(
120120
event="event: session created",
121121
metadata={"input_type": "syslog", "index": "main"},
122122
sample_name="requirement_test",
123123
),
124-
sample_event(
124+
SampleEvent(
125125
event="event: session closed",
126126
metadata={"input_type": "syslog", "index": "main"},
127127
sample_name="requirement_test",

0 commit comments

Comments
 (0)