Skip to content

Commit

Permalink
Remove duplicate codes
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Dec 2, 2024
1 parent c3c9db4 commit d0e4e73
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 51 deletions.
4 changes: 1 addition & 3 deletions tests/persistence/test_inmemory.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# -*- coding: utf-8 -*-
import unittest

from ..utils import ProcessWithCheckpoint

import plumpy

import plumpy
from ..utils import ProcessWithCheckpoint


class TestInMemoryPersister(unittest.TestCase):
Expand Down
4 changes: 2 additions & 2 deletions tests/persistence/test_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
if getattr(tempfile, 'TemporaryDirectory', None) is None:
from backports import tempfile

from ..utils import ProcessWithCheckpoint

import plumpy

from ..utils import ProcessWithCheckpoint


class TestPicklePersister(unittest.TestCase):
def test_save_load_roundtrip(self):
Expand Down
1 change: 0 additions & 1 deletion tests/rmq/test_process_comms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import asyncio
import copy

import kiwipy
import pytest
Expand Down
2 changes: 0 additions & 2 deletions tests/test_communications.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import pytest
from kiwipy import CommunicatorHelper

import pytest
from kiwipy import CommunicatorHelper
from plumpy.communications import LoopCommunicator


Expand Down
38 changes: 1 addition & 37 deletions tests/test_expose.py
Original file line number Diff line number Diff line change
@@ -1,47 +1,11 @@
# -*- coding: utf-8 -*-
import unittest

from .utils import NewLoopProcess

from plumpy.ports import PortNamespace
from plumpy.process_spec import ProcessSpec
from plumpy.processes import Process


def validator_function(input, port):
pass


class BaseNamespaceProcess(NewLoopProcess):
@classmethod
def define(cls, spec):
super().define(spec)
spec.input('top')
spec.input('namespace.sub_one')
spec.input('namespace.sub_two')
spec.inputs['namespace'].valid_type = (int, float)
spec.inputs['namespace'].validator = validator_function


class BaseProcess(NewLoopProcess):
@classmethod
def define(cls, spec):
super().define(spec)
spec.input('a', valid_type=str, default='a')
spec.input('b', valid_type=str, default='b')
spec.inputs.dynamic = True
spec.inputs.valid_type = str


class ExposeProcess(NewLoopProcess):
@classmethod
def define(cls, spec):
super().define(spec)
spec.expose_inputs(BaseProcess, namespace='base.name.space')
spec.input('c', valid_type=int, default=1)
spec.input('d', valid_type=int, default=2)
spec.inputs.dynamic = True
spec.inputs.valid_type = int
from .utils import NewLoopProcess


def validator_function(input, port):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_process_comms.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
import pytest
from tests import utils

import plumpy
from plumpy import process_comms
from tests import utils


class Process(plumpy.Process):
Expand Down
7 changes: 2 additions & 5 deletions tests/test_processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@

import asyncio
import enum
from plumpy.process_comms import KillMessage
import unittest

import kiwipy
import pytest
from tests import utils

import plumpy
import pytest

import plumpy
from plumpy import BundleKeys, Process, ProcessState
from plumpy.process_comms import KillMessage
from plumpy.utils import AttributesFrozendict
from tests import utils


class ForgetToCallParent(plumpy.Process):
Expand Down

0 comments on commit d0e4e73

Please sign in to comment.