Opened 12 years ago

Closed 12 years ago

#3804 defect closed worksforme (worksforme)

Can not use multiprocessing with trial on windows.

Reported by: ablmf Owned by: ablmf
Priority: normal Milestone:
Component: trial Keywords:
Cc: Jean-Paul Calderone Branch:
Author:

Description

Try the code below:

#test_call.py

import time
from multiprocessing import Process, Queue
from twisted.trial import unittest

import wx

FRAME_NUM = 4

def f(q):
    app = wx.PySimpleApp()
    frame = wx.Frame(None, wx.ID_ANY, "Hello World")
    frame.Show(True)
    q.put(frame.Handle)
    app.MainLoop()

def makeFrame():
    q = Queue()
    p = Process(target=f, args=(q,))
    p.start()
    return p, q.get()

class TestInvite(unittest.TestCase):

    def setUp(self):
        self.app = wx.PySimpleApp()
        self.frames = []
        for i in range(FRAME_NUM):
            self.frames.append(makeFrame())

    def testInvite(self):
        return

    def tearDown(self):
        self.vb.UserUnregister()

        for p, f in self.frames:
            p.terminate()

Error message

[ERROR]: test_call.py

Traceback (most recent call last):
  File "D:\Python26\Lib\site-packages\twisted\trial\runner.py", line 643, in loadByNames
    things.append(self.findByName(name))
  File "D:\Python26\Lib\site-packages\twisted\trial\runner.py", line 453, in findByName
    return reflect.namedAny(name)
  File "D:\Python26\lib\site-packages\twisted\python\reflect.py", line 463, in namedAny
    raise ObjectNotFound('%r does not name an object' % (name,))
twisted.python.reflect.ObjectNotFound: 'test_call.py' does not name an object

Change History (3)

comment:1 Changed 12 years ago by Jean-Paul Calderone

Cc: Jean-Paul Calderone added

The error message you're seeing doesn't seem to be related to Windows or the use of multiprocessing. The error message is reporting that it doesn't know how to turn "test_call.py" into a test suite - it can't find the tests you're trying to run.

What command are you running, and where is test_call.py in relation to the working directory you run it in?

comment:2 Changed 12 years ago by Glyph

Owner: changed from Jonathan Lange to ablmf

This really looks like a problem with PYTHONPATH or something; please reopen if there is actually a problem with Twisted here.

comment:3 Changed 12 years ago by Glyph

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.