-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Running a test module as a script. #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42): (couldn't open your your attachment) This seems to be a problem in comparing absolute path with relative path. I think i could fix it ... could you try to invokve: {{{ and report back if the problem goes away? |
Original comment by Jurko Gospodnetić (BitBucket: jurko, GitHub: jurko): I'll try the easy_install now and let you know the results... Here's the same attachment afain in .zip format. It should contain the following:
Best regards, --- 'ppp\xxx.py' ----------- def test_fail(): if name == "main": |
Original comment by Jurko Gospodnetić (BitBucket: jurko, GitHub: jurko): Yup, it seems the latest development version fixes the problem. My guess is that the fix is the additional os.path.abspath() call in:
So I guess the problem will 'resolve itself' in time as new releases get pushed out and I can safely ignore it for now. :-) And the whole idiom for calling the test script as a 'standalone script' using pytest.main([file]) - is there a better way or is this supposed to be ok? Best regards, |
Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42): pytest.main([file]) is ok i guess - however, "file" might have a ".pyc" or ".pyo" ending and thus might break. At least that's true on Python2. We can think about introducing a safer shortcut. Unfortunately pytest.main() is used already to mean pytest.main(sys.argv[1:]), see http://pytest.org/usage.html#calling-pytest-from-python-code Hum, you could actually do safely, even with the current release: {{{ }}} Maybe pytest.thismod() or something could be a shortcut. What do you think? |
Original comment by Jurko Gospodnetić (BitBucket: jurko, GitHub: jurko): As for a pytest.thismod() shortcut (or any other name you find suitable) - if implemented 'correctly' that would be a 'black box' solving all my problems - so that's just fine by me. :-)) And as to how to implement this shortcut - here are some more thoughts:
{{{ =============================================================== in 0.06 seconds =============================================================== Here I used a bbb.pyc file with no available bbb.py file. Hope this helps. Best regards, |
Original comment by Jurko Gospodnetić (BitBucket: jurko, GitHub: jurko): The ['--pyargs', name] error-reporting bug seems to have been fixed in changeset <>. As for the ['--pyargs', name] solution not working without the source .py test script being available - I opened a separate issue <<issue 22>>. |
Adding SELENIUM_URI to allow host, port and path to be set at once.
fix __multicall__ for pytest-profiling plugin
Originally reported by: Jurko Gospodnetić (BitBucket: jurko, GitHub: jurko)
I am trying to make my test modules runnable directly as scripts (e.g. python xxx.py) or as a python module (python -m xxx). Everything being done with Python 3.2.rc1 on Windows XP.
The closest I got so far is to add something like this to my test scripts:
However, this does not work in all the cases.
Imagine the following scenario (I have attached files modeling this exact scenario so it can be more easily reproduced):
In it I can do the following:
but trying this:
causes the following error:
Is there a better way to do get this functionality or is it something that is not supposed to be supported or is it something that needs fixing?
The error itself is reported from deep inside the py.py library and so far I have not been able to find a quick-fix for it.
Many thanks and best regards,
Jurko Gospodnetić
The text was updated successfully, but these errors were encountered: