I have two systems running the same set of Django unittests. Some of the tests use the #unittest.expectedFailure decorator.
On one system, these are running fine and reporting at the end of the test run OK (expected failures=10, unexpected successes=2).
On the other system, the same tests error, but raise _ExpectedFailure and _UnexpectedSuccess without tracebacks.
Has anyone seen this behavior before? Is it a configuration issue? Both systems are running Python 2.7, Django 1.3, and have unittest and unittest2 installed.
I have the problem and I got it to work by deleting the /usr/local/lib/python2.7 and then reinstalling everything from scratch.
The reason for this I believe is that python may not have cleared it's python object and cache files(*.pyc, *.pyo) from it's working directory. That is, not YOUR project's directory but where python actually runs from.
Not sure if that's it but it worked for me!!
Related
I'm developing a script in Python 3.9 that works perfectly on my personal PC. When I tried moving and running it on a server, which has an older python version, it gives me the following error:
Does anyone know how to fix this error?
I tried to install dotenv via pip manually, but it doesn't work.
I think you should use Pylaucher, to start Pylaucher you must Use Shebang (#) in The Script Run Pylauncher Command. Then you will be able to run multiple versions of python in Windows without getting errors. There are too many methods you can use; I strongly suggest this one since has once worked for me.
I am trying to run a GUI test using pytest and pywinauto. When I run the code normally, it does not complain.
However, when I am doing it via pytest, it throws a bunch of errors:
Windows fatal exception: code 0x8001010d
Note that the code still executes without problems and the cases are marked as passed. It is just that the output is polluted with these weird Windows exceptions.
What is the reason for this. Should I be concerned?
def test_01():
app = Application(backend='uia')
app.start(PATH_TO_MY_APP)
main = app.window(title_re="MY_APP")
main.wait('visible', timeout=8) # error occurs here
time.sleep(0.5)
win_title = f"MY_APP - New Project"
assert win_title.upper() == main.texts()[0].upper() # error occurs here
This is an effect of a change introduced with pytest 5.0.0. From the release notes:
#5440: The faulthandler standard library module is now enabled by default to help users diagnose crashes in C modules.
This functionality was provided by integrating the external pytest-faulthandler plugin into the core, so users should remove that plugin from their requirements if used.
For more information see the docs: https://docs.pytest.org/en/stable/usage.html#fault-handler
You can mute these errors as follows:
pytest -p no:faulthandler
I had the same problem with Python 3.7.7 32-bit and pytest 5.x.x. It was solved by downgrading pytest to v.4.0.0:
python -m pip install pytest==4.0
Perhaps all Python versions are not compatible with the newest pytest version(s).
My workaround for now is to install pytest==4.6.11
With 5.0.0 the problem occurs the first time.
W10 box.
Have this problem using pytest 6.2.5 and pytest-qt 4.0.2.
I tried np8's idea: still got a horrible crash (without message).
I tried Felix Zumstein's idea: still got a horrible crash (without message).
Per this thread it appears the issue (in 'Doze) is a crap DLL.
What's strange is that pytest-qt and the qtbot fixture seem to work very well... until I get to this one test. So I have concluded that I have done something too complicated in terms of mocking and patching for this crap 'Doze DLL to cope with.
For example, I mocked out two methods on a QMainWindow subclass which is created at the start of the test. But removing these mocks did not solve the problem.
I have so far spent about 2 hours trying to understand what specific feature of this test is so problematic. I am in fact trying to verify the functioning of a method on my main window class which "manufactures" menu items (QWidgets.QAction) based on about 4 parameters.
At this stage I basically have no idea what this "problem feature" is, but it might be the business of inspecting and examining the returned QAction object.
I am trying to make a standalone application using py2app with python3:
python3 setup.py py2app --packages=PyQt5
Everything seems to work just fine. But when one launches the application, the following errors are caught in Mac console:
14/04/16 13:27:27,688 app[98583]: objc[98583]: Class RunLoopModeTracker
is implemented in both
/Users/muammar/github/app/dist/app.app/Contents/Frameworks/QtCore.framework/Versions/5/QtCore
and /usr/local/Cellar/qt5/5.6.0/lib/QtCore.framework/Versions/5/QtCore.
One of the two will be used. Which one is undefined.
That is also reported for the classes: NotificationReceiver, QCocoaPageLayoutDelegate and others.
I read elsewhere, that placing a qt.conf file next to the application as suggested here should solve the problem. But actually it does not work in my case. Does anybody know how to avoid this problem?.
For those having this problem, I fix it by doing the following:
python3 setup.py py2app --packages=PyQt5
cp -R /usr/local/Cellar/qt5/5.6.0/plugins dist/mya.app/Contents/PlugIns
macdeployqt dist/my.app
The problem is gone, and it works everything OK.
Our project is a mostly J2EE based development with the automatic functional and integration tests written in Python. The test environment is Linux nonetheless developers use Windows 7 (64-bit). We would like to be able to execute the functional tests on the developer machines as well (before comitting). Unfortunately the pexpect-windows-portability issue would leave us no choice but:
To do some serious refactoring on our test libraries to be able to use both winpexpect (or wexpect) and pexpect depending on the os settings.
Or to use cygwin. Guess what, with this second option we seem to have an issue :-) Using Python 2.7.5 on Cygwin64 installing the requests package results in error:
pip says it can not find a file after downloading and extracting the library
easy install doesn't throw an explicit error, but leaves everything in the temporary dir
after copying the files under the site-packages directory a simple import requests in python causes the interpreter to exit
Has anybody encountered this problem? With Cygwin-32 requests install smoothly. (however we have some other issues - see my next post ;-))
Thank you in advance: Joe, the public
Also ran into the same issues when trying to install requests, all the options on http://docs.python-requests.org/en/latest/user/install/#install did not work. I went to https://github.com/kennethreitz/requests and then clicked on "Download Zip" and I got requests-master.zip.
Update: This should be fixed in Cygwin.
This was a bug in CPython that has been fixed in their master branch. I've pushed a candidate package to the Python maintainer for Cygwin, but you might try this hotfix.
I downloaded from "https://github.com/requests/requests" and then i just ran the setup.py from the requests-master folder ( this was placed in cygwin folder). After that I went to cygwin terminal and then I ran python --> import requests. Voila it worked.
I am running a basic script that sets up the django environment by itself, to enable me to test the ORM features of django without having to implement web pages. The script then imports one of the types defined in my models. This error doesn't happen when I run this script from iPython, only from eclipse. Simply doing this import causes a weird exception like the following:
Exception AttributeError: "'NoneType' object has no attribute 'print_exc'" in <bound method Signal._remove_receiver of <django.dispatch.dispatcher.Signal object at 0x026802B0>> ignored
My script is as follows:
from django.core.management import setup_environ
import settings
setup_environ(settings)
from stats.models import Person
for p in Person.objects.all():
print p.Name
After importing an existing Django project in Eclipse I had the same AttributeError
I just removed the *.pyc files... and it works... !?
right click on project ->pyDev -> remove *.pyc, *.pyo, ...
After some judicious googling, I'd say that Eclipse is causing the problem and that it may be hard to trace. print_exc is a function in Python's traceback module. Eclipse may be trying to show you a traceback, failing, and eating the result in the process.
I think a reasonable workaround would be to continue work on this script in a tool that doesn't present you with inscrutable errors. You may find an actual (fixable) error in your code, or you may find that Eclipse was raising a false alarm due to a bug in its Python integration.
If at that point you're unsure whether there is a problem with your code, adding some tests might be helpful.
Its possible that eclipse is using a different version of the python interpreter?
Could you give more details, such as the Person model.
Without seeing that I would guess the model attribute is meant to be in lowercase (ie p.name)
As far as i see, you do not havbe any problem with importing your modules. Try this to check if everything you need is ready for you. Probably that would not be the reason of your problem but better you check it too
iPuthon imports django system path automatically, so what you need is alresdy ready under your hands.
import sys
sys.path
check this out to see if all you need is there when you run it from eclipse, fiff with ipython result...