spectolabs / hoverpy Goto Github PK
View Code? Open in Web Editor NEWPython library for Hoverfly (now obsolete)
License: Apache License 2.0
Python library for Hoverfly (now obsolete)
License: Apache License 2.0
In Windows :
[httpd, self.stop_read], [self.stop_write], []
error: (10038, 'An operation was attempted on something that is not a socket')
Expected : It should say capture ok , But my firewall assked for approval to get them working . I have given access. but still is not working
We can have a status bar while downloading Downloading https://pypi.python.org/packages/d9/03/155b3e67fe35fe5b6f4227a8d9e96a14fda828b18199800d161bcefc1359/requests-2.12.3.tar.gz#md5=0cafdecd95a46b081dd5fcfa4978db7a
warning: no files found matching 'test_requests.py'
still exists, don't know it it should bother the user?
python setup.py test
is DOWNLOADING HOVERFLY FROM https://github.com/SpectoLabs/hoverfly/releases/download/v0.9.2/hoverfly_bundle_linux_amd64.zip? (Just a query as this was not the case earlier as I remember?) And again a status message with percentage of download would help.
May be you can update the Output section in http://hoverpy.readthedocs.io/en/latest/installation.html, to
testTemplate (hoverpy.tests.templates.testTemplates.TestTemplates) ... ok
testDecorators (hoverpy.tests.testDecorator.TestDecorators) ... ok
testCapture (hoverpy.tests.testVirtualisation.TestVirt) ... ok
testPlayback (hoverpy.tests.testVirtualisation.TestVirt) ... ok
testSimulation (hoverpy.tests.testVirtualisation.TestVirt) ... ok
testStressTest (hoverpy.tests.testVirtualisation.TestVirt) ... generating data took 4.189275
re-reading data, getting simulation, and writing it to disk took 0.795680
ok
testdbpath (hoverpy.tests.testVirtualisation.TestVirt) ... ok
Right now it is:
testTemplate (hoverpy.tests.templates.testTemplates.TestTemplates) ... ok
testCapture (hoverpy.tests.testVirtualisation.TestVirt) ... ok
testPlayback (hoverpy.tests.testVirtualisation.TestVirt) ... ok
as I remember having only 4 ok in the log earlier, and that matched the document text, entry sequence is also different.
python examples/basic/basic.py's
sample output can appear in the docs under "Running the examples"?
running
'python examples/readthedocs/readthedocs.py'
without doing capture first still produces the same traceback. We can handle that gracefully with custom message, telling the actual reason of failure.
In http://hoverpy.readthedocs.io/en/latest/readthedocs.html:
python examples/readthedocs/readthedocs.py
should be formatted as code.
Hoverfly v1.5.2 installed on the machine*, but when importing hoverpy, it installs hoverfly v0.10.0.
DOWNLOADING HOVERFLY FROM https://github.com/SpectoLabs/hoverfly/releases/download/v0.10.1/hoverfly_bundle_linux_amd64.zip TO /tmp/tmpm9e2399d
wget -O hoverfly.zip 'https://github.com/SpectoLabs/hoverfly/releases/download/v1.5.2/hoverfly_bundle_linux_amd64.zip' \
&& unzip hoverfly.zip hoverfly hoverctl -d /usr/bin \
&& rm hoverfly.zip
Same with the hoverpy docs
With out running virtualenv -
chell@LAPTOP-M83TAKIV MINGW64 ~/oliver/hoverpy (master)
$ python setup.py test
running test
Searching for requests
Reading https://pypi.python.org/simple/requests/
Best match: requests 2.12.3
Downloading https://pypi.python.org/packages/d9/03/155b3e67fe35fe5b6f4227a8d9e96a14fda828b18199800d161bcefc1359/requests-2.12.3.tar.gz#md5=0cafdecd95a46b081dd5fcfa4978db7a
Processing requests-2.12.3.tar.gz
Writing c:\users\chell\appdata\local\temp\easy_install-gbgwbe\requests-2.12.3\setup.cfg
Running requests-2.12.3\setup.py -q bdist_egg --dist-dir c:\users\chell\appdata\local\temp\easy_install-gbgwbe\requests-2.12.3\egg-dist-tmp-atndow
warning: no files found matching 'test_requests.py'
creating c:\users\chell\oliver\hoverpy.eggs\requests-2.12.3-py2.7.egg
Extracting requests-2.12.3-py2.7.egg to c:\users\chell\oliver\hoverpy.eggs
Installed c:\users\chell\oliver\hoverpy.eggs\requests-2.12.3-py2.7.egg
running egg_info
writing requirements to hoverpy.egg-info\requires.txtIt satsys in test Capture for long time.
writing hoverpy.egg-info\PKG-INFO
writing top-level names to hoverpy.egg-info\top_level.txt
writing dependency_links to hoverpy.egg-info\dependency_links.txt
reading manifest file 'hoverpy.egg-info\SOURCES.txt'
writing manifest file 'hoverpy.egg-info\SOURCES.txt'
running build_ext
testModify (hoverpy.tests.modify.testModify.TestModify) ... FAIL
testTemplate (hoverpy.tests.templates.testTemplates.TestTemplates) ... ok
testDecorators (hoverpy.tests.testDecorator.TestDecorators) ... ok
testCapture (hoverpy.tests.testVirtualisation.TestVirt) ...
Issue : It satsys in test Capture for long time.
Traceback (most recent call last):
File "c:\python27\lib\site-packages\hoverpy\hoverpy\hoverpy\tests\testVirtualisation.py", line 55, in testDecorators
epoch = testCapture()
File "c:\python27\lib\site-packages\hoverpy\hoverpy\hoverpy\decorators.py", line 13, in wrapped_f
return f(*args)
File "c:\python27\lib\site-packages\hoverpy\hoverpy\hoverpy\tests\testVirtualisation.py", line 42, in testCapture
j = r.json()
File "C:\Python27\lib\site-packages\requests\models.py", line 812, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Python27\lib\json_init_.py", line 339, in loads
return _default_decoder.decode(s)
File "C:\Python27\lib\json\decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python27\lib\json\decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
So far cannot find any catch in these examples:
Note: In http://hoverpy.readthedocs.io/en/latest/, modify_payload should nest under modify.
Following are the logs:
delays:
(.venv)[dushyant@localhost hoverpy]$ python examples/delays/delays.py
capturing responses from echo server
{u'original': u'0', u'md5': u'cfcd208495d565ef66e7dff9f98764da'}
{u'i': u'1'}
{u'original': u'2', u'md5': u'c81e728d9d4c2f636f067f89cc14862c'}
{u'i': u'3'}
{u'i': u'4'}
{u'original': u'5', u'md5': u'e4da3b7fbbce2345d7772b0674a318d5'}
{u'original': u'6', u'md5': u'1679091c5a880faf6fb5e6087eb1b2dc'}
{u'i': u'7'}
{u'i': u'8'}
{u'i': u'9'}
{u'message': u'Response delays updated.'}
{u'message': u'Response delays updated.'}
simulate
replaying delayed responses from echo server
{u'original': u'0', u'md5': u'cfcd208495d565ef66e7dff9f98764da'}
{u'i': u'1'}
{u'original': u'2', u'md5': u'c81e728d9d4c2f636f067f89cc14862c'}
{u'i': u'3'}
{u'i': u'4'}
{u'original': u'5', u'md5': u'e4da3b7fbbce2345d7772b0674a318d5'}
{u'original': u'6', u'md5': u'1679091c5a880faf6fb5e6087eb1b2dc'}
{u'i': u'7'}
{u'i': u'8'}
{u'i': u'9'}
modify:
(.venv)[dushyant@localhost hoverpy]$ python examples/modify/modify.py
something went wrong - deal with it gracefully
something went wrong - deal with it gracefully
response successfully modified, current date is 04:06:55 PM
something went wrong - deal with it gracefully
something went wrong - deal with it gracefully
response successfully modified, current date is 04:06:57 PM
response successfully modified, current date is 04:06:57 PM
something went wrong - deal with it gracefully
response successfully modified, current date is 04:06:59 PM
response successfully modified, current date is 04:06:59 PM
something went wrong - deal with it gracefully
response successfully modified, current date is 04:07:00 PM
response successfully modified, current date is 04:07:01 PM
response successfully modified, current date is 04:07:02 PM
response successfully modified, current date is 04:07:02 PM
something went wrong - deal with it gracefully
response successfully modified, current date is 04:07:04 PM
response successfully modified, current date is 04:07:04 PM
response successfully modified, current date is 04:07:05 PM
response successfully modified, current date is 04:07:05 PM
something went wrong - deal with it gracefully
something went wrong - deal with it gracefully
response successfully modified, current date is 04:07:07 PM
something went wrong - deal with it gracefully
response successfully modified, current date is 04:07:08 PM
something went wrong - deal with it gracefully
something went wrong - deal with it gracefully
something went wrong - deal with it gracefully
something went wrong - deal with it gracefully
response successfully modified, current date is 04:07:11 PM
urllib2
(.venv)[dushyant@localhost hoverpy]$ python examples/urllib2eg/urllib2eg.py
{"ip": "49.44.51.86"}
{"ip": "49.44.51.86"}
Currently, the test cases send requests to an external URL, which is a brittle dependency. Hoverpy should not rely on this approach. Instead, I suggest the use of a simple, internal web service, to be started on the setUp
and closed on the tearDown
.
We could use a lib as https://cherrypy.org to achieve this.
(.venv) C:\Users\chell\hoverpy\examples\delays>python delays.py
Traceback (most recent call last):
File "delays.py", line 10, in
with HoverPy(capture=True) as hp:
File "C:\Users\chell\hoverpy.venv\lib\site-packages\hoverpy-0.1.17-py2.7.egg\hoverpy_init_.py", line 77, in init
self._start()
File "C:\Users\chell\hoverpy.venv\lib\site-packages\hoverpy-0.1.17-py2.7.egg\hoverpy_init.py", line 305, in __start
raise ValueError("Could not start hoverfly!")
ValueError: Could not start hoverfly!
I tried running the test suite but got all the following errors:
running test
running egg_info
writing hoverpy.egg-info/PKG-INFO
writing dependency_links to hoverpy.egg-info/dependency_links.txt
writing requirements to hoverpy.egg-info/requires.txt
writing top-level names to hoverpy.egg-info/top_level.txt
reading manifest file 'hoverpy.egg-info/SOURCES.txt'
writing manifest file 'hoverpy.egg-info/SOURCES.txt'
running build_ext
testModify (hoverpy.tests.modify.testModify.TestModify) ... /Users/alvarocavalcanti/Projects/hoverpy/hoverpy/tests/modify/testModify.py:16: ResourceWarning: unclosed <socket.socket fd=7, family=AddressFamily.AF_INET6, type=SocketKind.SOCK_STREAM, proto=6, laddr=('::1', 52975, 0, 0), raddr=('::1', 8888, 0, 0)>
self.assertIn("modified!", r.text)
ok
testTemplate (hoverpy.tests.templates.testTemplates.TestTemplates) ... ok
testCapture (hoverpy.tests.testVirtualisation.TestVirt) ... /Users/alvarocavalcanti/Projects/hoverpy/.venv/lib/python3.6/site-packages/requests-2.19.1-py3.6.egg/requests/exceptions.py:25: ResourceWarning: unclosed <socket.socket fd=7, family=AddressFamily.AF_INET6, type=SocketKind.SOCK_STREAM, proto=6, laddr=('::1', 52982, 0, 0), raddr=('::1', 8888, 0, 0)>
super(RequestException, self).__init__(*args, **kwargs)
ERROR
testDecorators (hoverpy.tests.testVirtualisation.TestVirt) ... ERROR
testPlayback (hoverpy.tests.testVirtualisation.TestVirt) ... /usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/email/feedparser.py:475: ResourceWarning: unclosed <socket.socket fd=8, family=AddressFamily.AF_INET6, type=SocketKind.SOCK_STREAM, proto=6, laddr=('::1', 52994, 0, 0), raddr=('::1', 8888, 0, 0)>
for lineno, line in enumerate(lines):
ERROR
/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/case.py:633: ResourceWarning: unclosed <socket.socket fd=9, family=AddressFamily.AF_INET6, type=SocketKind.SOCK_STREAM, proto=6, laddr=('::1', 53001, 0, 0), raddr=('::1', 8888, 0, 0)>
outcome.errors.clear()
======================================================================
ERROR: testCapture (hoverpy.tests.testVirtualisation.TestVirt)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/alvarocavalcanti/Projects/hoverpy/hoverpy/tests/testVirtualisation.py", line 15, in testCapture
j = r.json()
File "/Users/alvarocavalcanti/Projects/hoverpy/.venv/lib/python3.6/site-packages/requests-2.19.1-py3.6.egg/requests/models.py", line 896, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
======================================================================
ERROR: testDecorators (hoverpy.tests.testVirtualisation.TestVirt)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/alvarocavalcanti/Projects/hoverpy/hoverpy/tests/testVirtualisation.py", line 55, in testDecorators
epoch = testCapture()
File "/Users/alvarocavalcanti/Projects/hoverpy/hoverpy/decorators.py", line 13, in wrapped_f
return f(*args)
File "/Users/alvarocavalcanti/Projects/hoverpy/hoverpy/tests/testVirtualisation.py", line 42, in testCapture
j = r.json()
File "/Users/alvarocavalcanti/Projects/hoverpy/.venv/lib/python3.6/site-packages/requests-2.19.1-py3.6.egg/requests/models.py", line 896, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
======================================================================
ERROR: testPlayback (hoverpy.tests.testVirtualisation.TestVirt)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/alvarocavalcanti/Projects/hoverpy/hoverpy/tests/testVirtualisation.py", line 26, in testPlayback
self.assertEquals(r1.json()["epoch"], r2.json()["epoch"])
File "/Users/alvarocavalcanti/Projects/hoverpy/.venv/lib/python3.6/site-packages/requests-2.19.1-py3.6.egg/requests/models.py", line 896, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
----------------------------------------------------------------------
Ran 5 tests in 1.434s
FAILED (errors=3)
Test failed: <unittest.runner.TextTestResult run=5 errors=3 failures=0>
error: Test failed: <unittest.runner.TextTestResult run=5 errors=3 failures=0>
I have Hoverfly installed and I am trying to run the example test, but I get:
DOWNLOADING HOVERFLY FROM https://github.com/SpectoLabs/hoverfly/releases/download/v0.10.1/hoverfly_bundle_OSX_arm64.zip TO /tmp/tmpha1omii0
Same thing with docker:
DOWNLOADING HOVERFLY FROM https://github.com/SpectoLabs/hoverfly/releases/download/v0.10.1/hoverfly_bundle_linux_aarch64.zip TO /tmp/tmphd3cg4ph
hoverfly --version
v1.5.2
Why is it trying to download an older version when it is installed?
I am trying to run this script:
https://docs.hoverfly.io/en/latest/pages/bindings/python.html
The pip package is installed:
hoverpy 0.2.2
hoverpy-0.2.2-py3.10.egg-info
Python 3.10 (Mac), 3.11 (Docker), M1 Mac
Running the basic example raises a JSONDecodeError.
Traceback (most recent call last):
File "/src/controller.py", line 10, in <module>
simData = requests.get("http://time.jsontest.com/").json()
File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
hoverfly v1.5.2*
hoverpy 0.2.2
DOWNLOADING HOVERFLY FROM https://github.com/SpectoLabs/hoverfly/releases/download/v0.10.1/hoverfly_bundle_linux_amd64.zip TO /tmp/tmpm9e2399d
I have Hoverfly installed and I am trying to run the example test, but I get:
DOWNLOADING HOVERFLY FROM https://github.com/SpectoLabs/hoverfly/releases/download/v0.10.1/hoverfly_bundle_OSX_arm64.zip TO /tmp/tmpha1omii0
Same thing with docker:
DOWNLOADING HOVERFLY FROM https://github.com/SpectoLabs/hoverfly/releases/download/v0.10.1/hoverfly_bundle_linux_aarch64.zip TO /tmp/tmphd3cg4ph
hoverfly --version
v1.5.2
I am trying to run this script:
https://docs.hoverfly.io/en/latest/pages/bindings/python.html
The pip package is installed:
hoverpy 0.2.2
hoverpy-0.2.2-py3.10.egg-info
I also tried following the installation instructions here:
https://github.com/SpectoLabs/hoverpy/blob/master/docs/pages/installation.rst
And received essentially the same error when running python setup.py test:
DOWNLOADING HOVERFLY FROM https://github.com/SpectoLabs/hoverfly/releases/download/v0.10.1/hoverfly_bundle_OSX_arm64.zip TO /var/folders/fp/v5mqcc0x1d92j597l1qgw7hr0000gp/T/tmp0o7l12f3
It successfully downloaded with --platform linux/amd64.
Python 3.10 (Mac, brew installed), 3.11 (Docker), M1 Mac
(.testenv) C:\Users\chell\hoverpy\examples\modify>python modify.py
Traceback (most recent call last):
File "modify.py", line 20, in
if "time" in r.json().keys():
File "C:\Users\chell\hoverpy.testenv\lib\site-packages\requests\models.py", line 850, in json
return complexjson.loads(self.text, **kwargs)
File "c:\python27\Lib\json_init_.py", line 339, in loads
return _default_decoder.decode(s)
File "c:\python27\Lib\json\decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "c:\python27\Lib\json\decoder.py", line 382, in raw_decode
raise ValueError("No JSON object could be decoded")
The GitHub description says this is "(now obsolete)" but HoverPy is still referred to on various docs. What's the authoritative status? Deprecated and people should do their own thing with pointing to a HoverFly proxy?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.