tarekziade / molosonic

Experiment with Arsenic
5 stars 1 forks source link

start() takes 1 positional argument but 2 were given #3

Closed pdehaan closed 6 years ago

pdehaan commented 6 years ago

Seeing this locally when trying to run the example from the README:

# requirements.txt
molotov
git+https://github.com/tarekziade/molosonic.git@master
$ molotov -cxv --max-runs 1 -w 5 loadtest3.py

**** Molotov v1.6. Happy breaking! ****
Preparing 5 workers...
OK
TypeError('start() takes 1 positional argument but 2 were given',)
  File "/Users/pdehaan/dev/github/pdehaan/ensemble-loadtests/venv/lib/python3.6/site-packages/molotov/worker.py", line 89, in session_setup
    await self._session_setup(self.wid, session)
  File "loadtest3.py", line 7, in _setup_session
    await setup_browser(session)
  File "/Users/pdehaan/dev/github/pdehaan/ensemble-loadtests/venv/lib/python3.6/site-packages/molosonic/__init__.py", line 30, in setup_browser
    session.browser = await session._session.start()
  File "/Users/pdehaan/dev/github/pdehaan/ensemble-loadtests/venv/lib/python3.6/site-packages/molosonic/__init__.py", line 19, in start
    self.driver = await self.gecko.start(Client)
SUCCESSES: 0 | FAILURES: 0
*** Bye ***
from molosonic import setup_browser, teardown_browser
import molotov

@molotov.setup_session()
async def _setup_session(wid, session):
    await setup_browser(session)

@molotov.teardown_session()
async def _teardown_session(wid, session):
    await teardown_browser(session)

@molotov.scenario(1)
async def example(session):
    firefox = session.browser

    # go to example.com
    await firefox.get('http://example.com')

    # wait up to 5 seconds to get the h1 element from the page
    h1 = await firefox.wait_for_element(5, 'h1')

    # print the text of the h1 element
    print(await h1.get_text())
tarekziade commented 6 years ago

should work now