Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

96
Visualizações
Trying to activate Django signal in my test

Hey I am trying to activate a signal in my test - but I can not seem to make it work.

This is my receiver

@receiver(post_save, sender=models.Allocation, dispatch_uid="close_overdue_invoice_tasks")

So how can "activate" it so it will call the method:

def close_overdue_invoice_tasks(sender, **kwargs):
    ...

All the signals works and my guess is that you manually have to activate the signals when running the tests.

I am using Pytest by the way.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Your signal will be called when you save your model that it is attached to. In this case, calling .save() on an instance of Allocation will cause the signal to be called.

You shouldn't have to activate the signals, they should be already set up. Check where you defined your signals and make sure that they are being executed during your test run.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda