Skip to content
This repository was archived by the owner on Dec 1, 2021. It is now read-only.

Commit 9bacf4a

Browse files
committed
Merge branch 'more-testing' into trio
2 parents e7f0752 + 3af11ea commit 9bacf4a

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

setup.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from setuptools import setup, find_packages
2+
3+
install_requires = []
4+
with open("requirements/main.in", "r") as fp:
5+
for line in fp:
6+
line.strip()
7+
if line:
8+
install_requires.append(line)
9+
10+
11+
setup(
12+
name="linehaul",
13+
use_scm_version={
14+
"local_scheme": lambda v: "+{.node}{}".format(v, ".dirty" if v.dirty else ""),
15+
"version_scheme": lambda v: "3.{.distance}.0".format(v),
16+
},
17+
packages=find_packages(exclude=["tests*"]),
18+
package_data={"linehaul": ["schema.json"]},
19+
entry_points={"console_scripts": ["linehaul = linehaul.cli:main"]},
20+
install_requires=install_requires,
21+
setup_requires=["setuptools_scm"],
22+
)

tests/syslog/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License");
2+
# you may not use this file except in compliance with the License.
3+
# You may obtain a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.

tests/syslog/test_parser.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License");
2+
# you may not use this file except in compliance with the License.
3+
# You may obtain a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS,
9+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
# See the License for the specific language governing permissions and
11+
# limitations under the License.
12+
13+
import datetime
14+
15+
from linehaul.syslog import Facility, Severity
16+
from linehaul.syslog.parser import SyslogMessage, parse
17+
18+
19+
def test_basic():
20+
msg = parse("<134>2018-07-20T02:19:20Z cache-itm18828 linehaul[411617]: A Message!")
21+
22+
assert msg == SyslogMessage(
23+
facility=Facility.local0,
24+
severity=Severity.informational,
25+
timestamp=datetime.datetime(
26+
year=2018, month=7, day=20, hour=2, minute=19, second=20
27+
),
28+
hostname="cache-itm18828",
29+
appname="linehaul",
30+
procid="411617",
31+
message="A Message!",
32+
)

0 commit comments

Comments
 (0)