Skip to content

Commit

Permalink
Exclude tests/.* for ruff linting
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Dec 1, 2024
1 parent a18e940 commit 0bb21a8
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 96 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
- id: ruff-format
exclude: &exclude_ruff >
(?x)^(

tests/.*|
)$

- id: ruff
Expand Down
8 changes: 3 additions & 5 deletions tests/base/test_statemachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, player, track):
super().__init__(player)
self.track = track
self._last_time = None
self._played = 0.
self._played = 0.0

def __str__(self):
if self.in_state:
Expand Down Expand Up @@ -55,8 +55,7 @@ class Paused(state_machine.State):
TRANSITIONS = {STOP: STOPPED}

def __init__(self, player, playing_state):
assert isinstance(playing_state, Playing), \
'Must provide the playing state to pause'
assert isinstance(playing_state, Playing), 'Must provide the playing state to pause'
super().__init__(player)
self.playing_state = playing_state

Expand Down Expand Up @@ -117,14 +116,13 @@ def stop(self):


class TestStateMachine(unittest.TestCase):

def test_basic(self):
cd_player = CdPlayer()
self.assertEqual(cd_player.state, STOPPED)

cd_player.play('Eminem - The Real Slim Shady')
self.assertEqual(cd_player.state, PLAYING)
time.sleep(1.)
time.sleep(1.0)

cd_player.pause()
self.assertEqual(cd_player.state, PAUSED)
Expand Down
2 changes: 2 additions & 0 deletions tests/persistence/test_inmemory.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import plumpy

import plumpy


class TestInMemoryPersister(unittest.TestCase):
def test_save_load_roundtrip(self):
Expand Down
6 changes: 2 additions & 4 deletions tests/rmq/test_process_comms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import copy

import kiwipy
from kiwipy import rmq
import pytest
import shortuuid
from kiwipy import rmq

import plumpy
from plumpy import process_comms
import plumpy.communications
from plumpy import process_comms

from .. import utils

Expand Down Expand Up @@ -44,7 +44,6 @@ def sync_controller(thread_communicator: rmq.RmqThreadCommunicator):


class TestRemoteProcessController:

@pytest.mark.asyncio
async def test_pause(self, thread_communicator, async_controller):
proc = utils.WaitForSignalProcess(communicator=thread_communicator)
Expand Down Expand Up @@ -123,7 +122,6 @@ def on_broadcast_receive(**msg):


class TestRemoteProcessThreadController:

@pytest.mark.asyncio
async def test_pause(self, thread_communicator, sync_controller):
proc = utils.WaitForSignalProcess(communicator=thread_communicator)
Expand Down
1 change: 0 additions & 1 deletion tests/test_expose.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from plumpy.ports import PortNamespace
from plumpy.process_spec import ProcessSpec
from plumpy.processes import Process
from test.utils import NewLoopProcess


def validator_function(input, port):
Expand Down
6 changes: 2 additions & 4 deletions tests/test_process_comms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
from tests import utils

import plumpy
from plumpy import communications, process_comms
from plumpy import process_comms


class Process(plumpy.Process):

def run(self):
pass


class CustomObjectLoader(plumpy.DefaultObjectLoader):

def load_object(self, identifier):
if identifier == 'jimmy':
return Process
Expand Down Expand Up @@ -45,7 +43,7 @@ async def test_continue():

@pytest.mark.asyncio
async def test_loader_is_used():
""" Make sure that the provided class loader is used by the process launcher """
"""Make sure that the provided class loader is used by the process launcher"""
loader = CustomObjectLoader()
proc = Process()
persister = plumpy.InMemoryPersister(loader=loader)
Expand Down
Loading

0 comments on commit 0bb21a8

Please sign in to comment.