Skip to content

Commit

Permalink
Move fixtures for modules into submodule (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
timmo001 committed Mar 9, 2024
1 parent 3bcfc34 commit 5a25564
Show file tree
Hide file tree
Showing 23 changed files with 460 additions and 386 deletions.
1 change: 1 addition & 0 deletions systembridgemodels/fixtures/modules/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Fixtures for modules."""
8 changes: 8 additions & 0 deletions systembridgemodels/fixtures/modules/battery.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""Fixture for battery module."""
from systembridgemodels.modules.battery import Battery

FIXTURE_BATTERY = Battery(
is_charging=True,
percentage=98.4,
time_remaining=12,
)
63 changes: 63 additions & 0 deletions systembridgemodels/fixtures/modules/cpu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
"""Fixture for cpu module."""
from systembridgemodels.modules.cpu import CPU, CPUFrequency, CPUStats, CPUTimes, PerCPU

FIXTURE_CPU = CPU(
count=4,
frequency=CPUFrequency(
current=2.3,
min=0.8,
max=3.1,
),
load_average=1.5,
per_cpu=[
PerCPU(
id=0,
frequency=CPUFrequency(
current=2.3,
min=0.8,
max=3.1,
),
power=50.0,
times=CPUTimes(
user=120.0,
system=30.0,
idle=600.0,
interrupt=0.0,
dpc=0.0,
),
times_percent=CPUTimes(
user=20.0,
system=5.0,
idle=100.0,
interrupt=0.0,
dpc=0.0,
),
usage=20.0,
voltage=1.2,
)
],
power=200.0,
stats=CPUStats(
ctx_switches=1000,
interrupts=500,
soft_interrupts=200,
syscalls=8000,
),
temperature=45.0,
times=CPUTimes(
user=480.0,
system=120.0,
idle=2400.0,
interrupt=0.0,
dpc=0.0,
),
times_percent=CPUTimes(
user=80.0,
system=20.0,
idle=400.0,
interrupt=0.0,
dpc=0.0,
),
usage=80.0,
voltage=1.2,
)
48 changes: 48 additions & 0 deletions systembridgemodels/fixtures/modules/disks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
"""Test fixtures for the disks module."""
from systembridgemodels.modules.disks import (
Disk,
DiskIOCounters,
DiskPartition,
Disks,
DiskUsage,
)

FIXTURE_DISKS = Disks(
devices=[
Disk(
name="name",
partitions=[
DiskPartition(
device="device",
mount_point="mountpoint",
filesystem_type="fstype",
options="options",
max_file_size=1,
max_path_length=2,
usage=DiskUsage(
total=1,
used=2,
free=3,
percent=40.2,
),
),
],
io_counters=DiskIOCounters(
read_bytes=1,
write_bytes=2,
read_count=3,
write_count=4,
read_time=5,
write_time=6,
),
)
],
io_counters=DiskIOCounters(
read_bytes=1,
write_bytes=2,
read_count=3,
write_count=4,
read_time=5,
write_time=6,
),
)
18 changes: 18 additions & 0 deletions systembridgemodels/fixtures/modules/displays.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""Fixtures for displays module."""
from systembridgemodels.modules.displays import Display

FIXTURE_DISPLAYS = [
Display(
id="abc123",
name="name",
resolution_horizontal=1920,
resolution_vertical=1080,
x=1920,
y=1080,
width=1920,
height=1080,
is_primary=True,
pixel_clock=60.0,
refresh_rate=60.0,
)
]
19 changes: 19 additions & 0 deletions systembridgemodels/fixtures/modules/gpus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""Fixtures for GPU models."""
from systembridgemodels.modules.gpus import GPU

FIXTURE_GPUS = [
GPU(
id="abc123",
name="name",
core_clock=1000.0,
core_load=100.0,
fan_speed=100.0,
memory_clock=1000.0,
memory_load=100.0,
memory_free=1000.0,
memory_used=1000.0,
memory_total=1000.0,
power_usage=100.0,
temperature=100.0,
)
]
27 changes: 27 additions & 0 deletions systembridgemodels/fixtures/modules/media.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""Fixtures for media models."""
from systembridgemodels.modules.media import Media

FIXTURE_MEDIA = Media(
album_artist="Album Artist",
album_title="Album Title",
artist="Artist",
duration=100,
is_fast_forward_enabled=True,
is_next_enabled=True,
is_pause_enabled=True,
is_play_enabled=True,
is_previous_enabled=True,
is_rewind_enabled=True,
is_stop_enabled=True,
playback_rate=1.0,
position=100,
repeat="repeat",
shuffle=True,
status="status",
subtitle="subtitle",
thumbnail="thumbnail",
title="title",
track_number=1,
type="type",
updated_at=100,
)
26 changes: 26 additions & 0 deletions systembridgemodels/fixtures/modules/memory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Fixture for memory module."""
from systembridgemodels.modules.memory import Memory, MemorySwap, MemoryVirtual

FIXTURE_MEMORY = Memory(
swap=MemorySwap(
total=1000,
used=500,
free=500,
percent=50.0,
sin=100,
sout=100,
),
virtual=MemoryVirtual(
total=1000,
available=500,
percent=50.0,
used=500,
free=500,
active=500,
inactive=500,
buffers=500,
cached=500,
wired=500,
shared=500,
),
)
57 changes: 57 additions & 0 deletions systembridgemodels/fixtures/modules/networks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
"""Fixture for networks module."""

from systembridgemodels.modules.networks import (
Network,
NetworkAddress,
NetworkConnection,
NetworkIO,
Networks,
NetworkStats,
)

FIXTURE_NETWORKS = Networks(
connections=[
NetworkConnection(
fd=1,
family=2,
type=3,
laddr="laddr",
raddr="raddr",
status="status",
pid=4,
)
],
io=NetworkIO(
bytes_sent=1,
bytes_recv=2,
packets_sent=3,
packets_recv=4,
errin=5,
errout=6,
dropin=7,
dropout=8,
),
networks=[
Network(
name="name",
addresses=[
NetworkAddress(
address="address",
netmask="netmask",
broadcast="broadcast",
ptp="ptp",
)
],
stats=NetworkStats(
isup=True,
duplex="duplex",
speed=1,
mtu=2,
flags=[
"flag1",
"flag2",
],
),
)
],
)
16 changes: 16 additions & 0 deletions systembridgemodels/fixtures/modules/processes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""Fixture for processes module."""
from systembridgemodels.modules.processes import Process

FIXTURE_PROCESSES = [
Process(
id=1234,
name="name",
cpu_usage=12.3,
created=12.3,
memory_usage=12.3,
path="/path",
status="running",
username="username",
working_directory="/working/directory",
)
]
104 changes: 104 additions & 0 deletions systembridgemodels/fixtures/modules/sensors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
"""Fixture for sensors module."""
from systembridgemodels.modules.sensors import (
Sensors,
SensorsNVIDIA,
SensorsNVIDIAChipset,
SensorsNVIDIADisplay,
SensorsNVIDIADriver,
SensorsNVIDIAGPU,
SensorsWindows,
SensorsWindowsHardware,
SensorsWindowsSensor,
)

FIXTURE_SENSORS = Sensors(
fans=None,
temperatures=None,
windows_sensors=SensorsWindows(
hardware=[
SensorsWindowsHardware(
id="id",
name="name",
type="type",
subhardware=[
SensorsWindowsHardware(
id="id",
name="name",
type="type",
subhardware=[],
sensors=[
SensorsWindowsSensor(
id="id",
name="name",
type="type",
value=12.3,
)
],
)
],
sensors=[
SensorsWindowsSensor(
id="id",
name="name",
type="type",
value=12.3,
)
],
)
],
nvidia=SensorsNVIDIA(
chipset=SensorsNVIDIAChipset(
id=1234,
name="name",
flags="flags",
vendor_id=1234,
vendor_name="Vendor Name",
),
displays=[
SensorsNVIDIADisplay(
id=1234,
name="name",
active=True,
available=True,
connected=True,
dynamic=True,
aspect_horizontal=16,
aspect_vertical=9,
brightness_current=90,
brightness_default=80,
brightness_max=100,
brightness_min=0,
color_depth="Color Depth",
connection_type="Connection Type",
pixel_clock=60,
refresh_rate=144,
resolution_horizontal=1920,
resolution_vertical=1080,
)
],
driver=SensorsNVIDIADriver(
branch_version="Branch Version",
interface_version="Interface Version",
version=1234,
),
gpus=[
SensorsNVIDIAGPU(
id=1234,
name="name",
bios_oem_revision=1234,
bios_revision=1234,
bios_version="bios_version",
current_fan_speed_level=1234,
current_fan_speed_rpm=1234,
driver_model=1234,
memory_available=1234,
memory_capacity=1234,
memory_maker="Memory Maker",
serial="abc123",
system_type="System Type",
type="Type",
)
],
),
),
)
Loading

0 comments on commit 5a25564

Please sign in to comment.