Skip to content

Commit

Permalink
add test for pytest-dev#93 relating to scrapy and pytest 5.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
altendky committed Mar 30, 2020
1 parent 9d701e8 commit 45954d3
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions testing/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,3 +696,34 @@ def test_succeed():
testdir.makepyfile(test_file)
rr = testdir.run(sys.executable, "-m", "pytest", "-v", *cmd_opts)
assert "WrongReactorAlreadyInstalledError" in rr.stderr.str()


def test_scrapy____something(testdir, cmd_opts):
test_file = """
import sys
import twisted.internet.reactor
import twisted.internet.defer
import twisted.internet.protocol
import twisted.trial.unittest
class Protocol(twisted.internet.protocol.ProcessProtocol):
def __init__(self):
self.deferred = twisted.internet.defer.Deferred()
def processEnded(self, status):
self.deferred.callback(self)
class Test(twisted.trial.unittest.TestCase):
@twisted.internet.defer.inlineCallbacks
def test(self):
protocol = Protocol()
command = [sys.executable, '--version']
twisted.internet.reactor.spawnProcess(protocol, command[0], command)
yield protocol.deferred
"""
testdir.makepyfile(test_file)
rr = testdir.run(sys.executable, "-m", "pytest", "-v", *cmd_opts)
assert_outcomes(rr, {"passed": 1})

0 comments on commit 45954d3

Please sign in to comment.