@@ -363,64 +363,4 @@ class IBMPythonActionContainerTests extends BasicActionRunnerTests with WskActor
363363 e should include(" Traceback" )
364364 })
365365 }
366-
367- it should " be able to import additional packages as installed in the image" in {
368- val (out, err) = withActionContainer() { c =>
369- val code = """
370- |from bs4 import BeautifulSoup
371- |from dateutil.parser import *
372- |import httplib2
373- |from lxml import etree
374- |import requests
375- |from scrapy.item import Item, Field
376- |import simplejson as json
377- |from twisted.internet import protocol, reactor, endpoints
378- |import socket
379- |from kafka import BrokerConnection
380- |
381- |def main(args):
382- | socket.setdefaulttimeout(120)
383- | b = BeautifulSoup('<html><head><title>python action test</title></head></html>', 'html.parser')
384- | h = httplib2.Http().request('https://openwhisk.ng.bluemix.net/api/v1')[0]
385- | t = parse('2016-02-22 11:59:00 EST')
386- | r = requests.get('https://openwhisk.ng.bluemix.net/api/v1')
387- | j = json.dumps({'foo':'bar'}, separators = (',', ':'))
388- | kafka = BrokerConnection("it works", 9093, None)
389- |
390- | return {
391- | "bs4": str(b.title),
392- | "httplib2": h.status,
393- | "dateutil": t.strftime("%A"),
394- | "lxml": etree.Element("root").tag,
395- | "json": j,
396- | "request": r.status_code,
397- | "kafka_python": kafka.host
398- | }
399- """ .stripMargin
400-
401- val (initCode, _) = c.init(initPayload(code))
402- initCode should be(200 )
403-
404- val (runCode, runRes) = c.run(runPayload(JsObject ()))
405- runCode should be(200 ) // action writer returning an error is OK
406-
407- runRes shouldBe defined
408- runRes should be(
409- Some (JsObject (
410- " bs4" -> " <title>python action test</title>" .toJson,
411- " httplib2" -> 200 .toJson,
412- " dateutil" -> " Monday" .toJson,
413- " lxml" -> " root" .toJson,
414- " json" -> JsObject (" foo" -> " bar" .toJson).compactPrint.toJson,
415- " request" -> 200 .toJson,
416- " kafka_python" -> " it works" .toJson)))
417- }
418-
419- checkStreams(out, err, {
420- case (o, e) =>
421- o shouldBe empty
422- e shouldBe empty
423- })
424- }
425-
426366}
0 commit comments