[pytest-dev] pytest script sample

Petr Viktorin encukou at gmail.com
Tue Jan 27 23:07:27 CET 2015


Hello,
We had exactly this problem at work. I used Paramiko to connect to the
remote machines, then made openssh (i.e. shelling out to ssh) an
option too.
When we moved to pytest, I tore this out into a stand-alone plugin –
https://github.com/encukou/pytest-multihost/
Our use cases were a bit more complex, so the configuration isn't very
straightforward, but maybe you will find the plugin useful.

On Tue, Jan 27, 2015 at 9:59 PM, Brack, Laurent P. <lpbrac at dolby.com> wrote:
> Hi Abdelillah,
>
> I thought somebody would have something smarter to say than what I am about
> to say, but here it is.
>
> If the remote system you are trying to test has python installed, then I
> suggest that you use pytest-xdist
> and distribute the tests on that machine.
>
> However if your tests require access to resources local to the machine where
> pytest runs, I suggest you use
> paramiko. We use it extensively for embedded device testing.
>
> Basically, you want to do something like create an SSHClient (and even
> perhaps an SFTP one) in a pytest fixture (scope set to session)
>
> http://pytest.org/latest/fixture.html
>
> For paramiko, here is an old but still valid article on Paramiko
> http://jessenoller.com/blog/2009/02/05/ssh-programming-with-paramiko-completely-different
>
> I am sure that after reading both, you can figure out what you need to do
> with very little effort.
>
> Good luck
>
> /Laurent
>
>
>
>
>
> On Jan 27, 2015, at 12:31 PM, Abdelillah Asraoui <aasraoui at gmail.com> wrote:
>
> Hello All,
>
> I'm not getting a response here, is there another alias to send this request
> to ?
>
>
> Thanks & Best Regard,
>
> Abdelillah
>
> On Sun, Jan 25, 2015 at 5:15 PM, Abdelillah Asraoui <aasraoui at gmail.com>
> wrote:
>>
>> Hello All,
>> I'm a newbie to pytest, would like to get minimum setup of files
>> in pytest:
>>
>> + lib
>> +config file for testbed
>> +test script
>>
>> to do the following tasks :
>> 1. ssh to a linux machine
>> 2. run some linux commands
>>
>> Can someone point out an example where i can take a look at this..
>>
>> Thanks in Advance,
>> Abdelillah
>
>
> _______________________________________________
> pytest-dev mailing list
> pytest-dev at python.org
> https://mail.python.org/mailman/listinfo/pytest-dev
>
>
>
> _______________________________________________
> pytest-dev mailing list
> pytest-dev at python.org
> https://mail.python.org/mailman/listinfo/pytest-dev
>


More information about the pytest-dev mailing list