質問

I have been working on a test script for a while and found what I think is an issue I can't solve. From research I found that the tests are run on the host machine not the nodes this is fine until I want to check a file has downloaded into a directory I use Linux as my development machine and windows are my node machines so the path is formatted for Linux and looks on the host machine not the node. Here is my code that gets the path.

os.path.isfile(os.path.expanduser('~') + '/Downloads/mpdf.pdf')

This is the path I get back

/home/ben/Downloads/mpdf.pdf

Does anyone have any ideas how I could get the path from the node machine and check for a file.

役に立ちましたか?

解決

The solution I came up with to avoid building more complexity than was needed was not do download the file but run a link and check if it was successful with the status code of 200.

responce = urllib2.urlopen('http://address.co/download')
assert responce.getcode() == 200

This is my solution and it seems to work and I don't need to download the file any more that is better on the bandwidth of the server I am running my tests on.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top