Skip to content

Conversation

sureshvv
Copy link

No description provided.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.37%) to 90.52% when pulling 4d31822 on sureshvv:splinter-webdriver-executable into fa4dc1e on pytest-dev:master.

@sureshvv
Copy link
Author

use keyword style for passing such long list of arguments

Are you sure this is a good idea? The arguments already have long names and they are fixtures so cannot make then short, We will end up invoking it like this:

get_args(splinter_webdriver_executavle=splinter_webdriver_executable
splinter_webdriver_executavle=splinter_webdriver_executable
splinter_webdriver_executavle=splinter_webdriver_executable
splinter_webdriver_executavle=splinter_webdriver_executable
splinter_webdriver_executavle=splinter_webdriver_executable
splinter_webdriver_executavle=splinter_webdriver_executable
splinter_webdriver_executavle=splinter_webdriver_executable
splinter_webdriver_executavle=splinter_webdriver_executable
),

Since this is an internal function anyway, I think it is better to keeo it as it is.

@bubenkoff
Copy link
Member

nobody stops you to rename the parameters in get_args function so it will
look like:

get_args(executable=splinter_webdriver_executable,
firefox_profile_directory=splinter_firefox_profile_directory...
which is still much better than positional arguments

On 14 April 2015 at 11:01, sureshvv notifications@github.com wrote:

use keyword style for passing such long list of arguments

Are you sure this is a good idea? The arguments already have long names
and they are fixtures so cannot make then short, We will end up invoking it
like this:

get_args(splinter_webdriver_executavle=splinter_webdriver_executable
splinter_webdriver_executavle=splinter_webdriver_executable
splinter_webdriver_executavle=splinter_webdriver_executable
splinter_webdriver_executavle=splinter_webdriver_executable
splinter_webdriver_executavle=splinter_webdriver_executable
splinter_webdriver_executavle=splinter_webdriver_executable
splinter_webdriver_executavle=splinter_webdriver_executable
splinter_webdriver_executavle=splinter_webdriver_executable
),

Since this is an internal function anyway, I think it is better to keeo it
as it is.


Reply to this email directly or view it on GitHub
#24 (comment)
.

Anatoly Bubenkov

@sureshvv
Copy link
Author

But then the code inside get_args will have to change, and it will become confusing to people who know/follow the code. Currently git diff now shows the same block of code extracted and neatly moved up into a separate function.

While I agree that the keyword style arguments will make the test look prettier, I am not so sure that it is an overall improvement.

@bubenkoff
Copy link
Member

git diff will also show you renamed arguments, which is pretty readable,
don't worry too much
i worry more about how it looks after refactoring

On 14 April 2015 at 11:35, sureshvv notifications@github.com wrote:

But then the code inside get_args will have to change, and it will become
confusing to people who know/follow the code. Currently git diff now shows
the same block of code extracted and neatly moved up into a separate
function.

While I agree that the keyword style arguments will make the test look
prettier, I am not so sure that it is an overall improvement.


Reply to this email directly or view it on GitHub
#24 (comment)
.

Anatoly Bubenkov

Suresh V added 2 commits April 14, 2015 15:26
…-webdriver-executable

Conflicts:
	pytest_splinter/plugin.py
	tests/test_plugin.py
@coveralls
Copy link

Coverage Status

Coverage increased (+0.85%) to 91.0% when pulling 97deda8 on sureshvv:splinter-webdriver-executable into cb4f566 on pytest-dev:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.85%) to 91.0% when pulling 5216103 on sureshvv:splinter-webdriver-executable into cb4f566 on pytest-dev:master.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you forget to pass as kwargs?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't follow your question.

get_args returns a dict which is passed as kwargs to the Browser() constructor. get_args has keyword arguments.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

call get_args like:

get_args(driver=splinter_webdriver,....

@coveralls
Copy link

Coverage Status

Coverage increased (+0.85%) to 91.0% when pulling 60f321c on sureshvv:splinter-webdriver-executable into cb4f566 on pytest-dev:master.

bubenkoff added a commit that referenced this pull request Apr 14, 2015
add option --splinter-webdriver-executable for phantomjs and chrome
@bubenkoff bubenkoff merged commit e556275 into pytest-dev:master Apr 14, 2015
@bubenkoff
Copy link
Member

thanks!
I'll fix those minor pep257 issues myself
in general it's good idea to set up your editor the way it checks that

@bubenkoff
Copy link
Member

1.3.5 is out

@sureshvv
Copy link
Author

Thank you. Is pep257 checking not part of tox tests? I thought I addressed all the issues.

@bubenkoff
Copy link
Member

now it is :)

On 20 April 2015 at 21:47, sureshvv notifications@github.com wrote:

Thank you. Is pep257 checking not part of tox tests? I thought I addressed
all the issues.


Reply to this email directly or view it on GitHub
#24 (comment)
.

Anatoly Bubenkov

@bh
Copy link
Member

bh commented Apr 21, 2015

I have an issue after this pull request. My phantomjs binary is in ~/.virtualenvs/mx/bin/ (installed via nodeenv). After update to current version of pytest-splinter, I always get the following exception:

    def start(self):
        """
            Starts PhantomJS with GhostDriver.

            :Exceptions:
             - WebDriverException : Raised either when it can't start the service
               or when it can't connect to the service
            """
        try:
            self.process = subprocess.Popen(self.service_args, stdin=subprocess.PIPE,
                                            close_fds=platform.system() != 'Windows',
                                            stdout=self._log, stderr=self._log)

        except Exception as e:
>           raise WebDriverException("Unable to start phantomjs with ghostdriver.", e)
E           selenium.common.exceptions.WebDriverException: Message: Unable to start phantomjs with ghostdriver.
E           Screenshot: available via screen

I fixed this with this workaround in my conftest.py:

@pytest.fixture(scope='session')
def splinter_webdriver_executable(request):
    return distutils.spawn.find_executable(request.config.option.splinter_webdriver)

@bubenkoff
Copy link
Member

thanks for noticing!
please check out 1.3.6 which is just out

@sureshvv
Copy link
Author

--splinter-webdriver-executable=$HOME/.virtualenvs/mx/bin should help you. But not sure why this pull request broke it. Was it working before?

@bubenkoff
Copy link
Member

look at the last commit :)

@sureshvv
Copy link
Author

aah.. coincidentally named fixtures :)

@bh
Copy link
Member

bh commented Apr 21, 2015

On 04/21/2015 01:43 PM, sureshvv wrote:

--splinter-webdriver-executable=$HOME/.virtualenvs/mx/bin should help
you. But not sure why this pull request broke it. Was it working before?


Reply to this email directly or view it on GitHub
#24 (comment).

Of couse. It should has to be possible to find the binary in $PATH. I
don't want to be too explicitly ;)

@bh
Copy link
Member

bh commented Apr 21, 2015

On 04/21/2015 01:50 PM, Benjamin Hedrich wrote:

On 04/21/2015 01:43 PM, sureshvv wrote:

--splinter-webdriver-executable=$HOME/.virtualenvs/mx/bin should help
you. But not sure why this pull request broke it. Was it working before?


Reply to this email directly or view it on GitHub
#24 (comment).

Of couse. It should has to be possible to find the binary in $PATH. I
don't want to be too explicitly ;)

py.test --cov=mx --cov-report=term-missing --cov-report html mx/

test session starts

platform linux -- Python 3.4.3 -- py-1.4.26 -- pytest-2.7.0
rootdir: /home/bhe/devel/mx/src, inifile: pytest.ini
plugins: splinter, bdd, cov, django, ipdb, rerunfailures, xdist
collected 375 items

mx/account/tests/acceptance/test_email_confirmation.py ..
[...]

With 1.3.6 the issue seems to be resolved! Thank you!

@sureshvv
Copy link
Author

Actually I think it is better to raise an Exception if executable not found rather than quietly ignore the option,

@blueyed
Copy link
Contributor

blueyed commented Apr 21, 2015

btw: while looking into why the error from subprocess.Popen (the exception) is not
displayed, I've found a bug about the usage of WebDriverException in Selenium's
driver. See SeleniumHQ/selenium#475.

@blueyed
Copy link
Contributor

blueyed commented Apr 21, 2015

And I agree with @sureshvv: it's an error and should not pass silently.

@bubenkoff
Copy link
Member

@sureshvv but where do you see that we silently ignore the option?

@sureshvv
Copy link
Author

@bubenkoff @blueyed Sorry.. I was reading too fast :-) It is fine as it is

@sureshvv sureshvv deleted the splinter-webdriver-executable branch April 21, 2015 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants