Yelp / Testify

A more pythonic testing framework.
Other
306 stars 67 forks source link

Windows support (two methods, both easy) #236

Closed josiahcarlson closed 10 years ago

josiahcarlson commented 10 years ago

The use of the pwd module in https://github.com/Yelp/Testify/blob/master/testify/test_program.py to determine the current user name prevents Testify from running in Windows at all.

Omitting the 'buildbot' user check on Windows is easy. First, a quick wrap of the pwd import:

try:
    import pwd
except ImportError:
    pwd = None

Then a small change to the condition on line 165 to:

if pwd and pwd.getpwuid(os.getuid()).pw_name == 'buildbot':

Those two changes are sufficient to getting Testify to run on Windows.

Alternatively, switching from pwd to getpass, then using getpass.getuser() is available on all platforms, though does allow the controlling terminal to lie via environment variables (I'm not sure that's an issue or not).

bukzor commented 10 years ago

Josiah, cut a branch and put it through Travis, then we'll merge.

--phone is hard. On Mar 17, 2014 5:14 PM, "Josiah Carlson" notifications@github.com wrote:

The use of the pwd module in https://github.com/Yelp/Testify/blob/master/testify/test_program.py to determine the current user name prevents Testify from running in Windows at all.

Omitting the 'buildbot' user check on Windows is easy. First, a quick wrap of the pwd import:

try: import pwdexcept ImportError: pwd = None

Then a small change to the condition on line 165 to:

if pwd and pwd.getpwuid(os.getuid()).pw_name == 'buildbot':

Those two changes are sufficient to getting Testify to run on Windows.

Alternatively, switching from pwd to getpass, then using getpass.getuser()is available on all platforms, though does allow the controlling terminal to lie via environment variables (I'm not sure that's an issue or not).

Reply to this email directly or view it on GitHubhttps://github.com/Yelp/Testify/issues/236 .

bukzor commented 10 years ago

That will also give you an opportunity to do manual acceptance testing, or if you're feeling Programmatically Correct, write automated ones.

--phone is hard. On Mar 17, 2014 5:14 PM, "Josiah Carlson" notifications@github.com wrote:

The use of the pwd module in https://github.com/Yelp/Testify/blob/master/testify/test_program.py to determine the current user name prevents Testify from running in Windows at all.

Omitting the 'buildbot' user check on Windows is easy. First, a quick wrap of the pwd import:

try: import pwdexcept ImportError: pwd = None

Then a small change to the condition on line 165 to:

if pwd and pwd.getpwuid(os.getuid()).pw_name == 'buildbot':

Those two changes are sufficient to getting Testify to run on Windows.

Alternatively, switching from pwd to getpass, then using getpass.getuser()is available on all platforms, though does allow the controlling terminal to lie via environment variables (I'm not sure that's an issue or not).

Reply to this email directly or view it on GitHubhttps://github.com/Yelp/Testify/issues/236 .

bukzor commented 10 years ago

With respect automated acceptance testing, it may be sufficient to add some lines to the Travis YAML -- I don't know their Windows support story.

--phone is hard. On Mar 18, 2014 1:59 PM, "Buck Golemon" buck.2019@gmail.com wrote:

That will also give you an opportunity to do manual acceptance testing, or if you're feeling Programmatically Correct, write automated ones.

--phone is hard. On Mar 17, 2014 5:14 PM, "Josiah Carlson" notifications@github.com wrote:

The use of the pwd module in https://github.com/Yelp/Testify/blob/master/testify/test_program.py to determine the current user name prevents Testify from running in Windows at all.

Omitting the 'buildbot' user check on Windows is easy. First, a quick wrap of the pwd import:

try: import pwdexcept ImportError: pwd = None

Then a small change to the condition on line 165 to:

if pwd and pwd.getpwuid(os.getuid()).pw_name == 'buildbot':

Those two changes are sufficient to getting Testify to run on Windows.

Alternatively, switching from pwd to getpass, then using getpass.getuser() is available on all platforms, though does allow the controlling terminal to lie via environment variables (I'm not sure that's an issue or not).

Reply to this email directly or view it on GitHubhttps://github.com/Yelp/Testify/issues/236 .

jareyes409 commented 10 years ago

I did a branch with the changes suggested by Josiah and the other few that occur when you run the suite in Windows. As far as the acceptance testing, I haven't gotten that intimate with the code and thus haven't written those tests. If they're needed let me know and I can dig deeper and add them.

josiahcarlson commented 10 years ago

Travis-ci does not support Windows. Also, the changes that I gave are obviously correct to anyone who spends at least 5 minutes checking.

Incidentally, we've been running with the changes I described for the last 3 months on Windows machines that use Testify with Selenium Webdriver, and we've not experienced any issues with that configuration.

bukzor commented 10 years ago

pull request, please.

jareyes409 commented 10 years ago

Pull request already submitted. #245.

bukzor commented 10 years ago

I believe this is resolved.