child_exception raised
Closed this issue · 2 comments
antonioj-mattos commented
When executing my test code a exception is thrown. I have searched the web for some information that could help but without success.
The models are a bit complex so I have used a factory (code ommited), but I don't think it is relevant to the problem. Anyway, if required I can create a mininal reproducible code.
The tests are run inside a Docker container.
Docker version 17.03.1-ce, build c6d412e
Python 2.7.13
Django==1.9.2
django-concurrent-test-helper==0.2.9
psycopg2==2.5.1
The command I used. Not clear if I have to do anything different here.
python manage.py test --settings=protocolo.test_settings protocolo.tests.TestesConcorrenciaProcesso
Exception in thread Thread-44:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/local/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/local/lib/python2.7/site-packages/django_concurrent_tests/utils.py", line 44, in target
stderr=subprocess.PIPE,
File "/usr/local/lib/python2.7/subprocess.py", line 390, in __init__
errread, errwrite)
File "/usr/local/lib/python2.7/subprocess.py", line 1024, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Test code:
def obteve_successo(result):
return result is True and not isinstance(result, Exception)
def criar_processo(setor=None):
return ProcessoFactory(setor_origem=setor)
class TestesConcorrenciaProcesso(TransactionTestCase):
def test_criar_processos_concorrentemente(self):
setor = SetorFactory()
processos = call_concurrently(20, criar_processo, setor=setor)
sucesso = all(map(obteve_successo, processos))
self.assertTrue(sucesso)
I'd appreciate any help.
anentropic commented
Hi
we have this code:
cmd = [
getattr(settings, 'MANAGE_PY_PATH', 'manage.py'),
'concurrent_call_wrapper',
function_path,
'--kwargs=%s' % serialized_kwargs,
]
this means your manage.py
file needs to be executable, with the #!/usr/bin/env python
line at the top
otherwise in your settings.py
file you need to set
MANAGE_PY_PATH = 'python manage.py`
antonioj-mattos commented
Got it. Thank you very much.