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

157
Visualizações
Running "python -m unittest" failing with maven exec-maven-plugin

I am trying to configure my maven build so that mvn test runs my python tests in addition to my java tests. I am trying to use the exec-maven-plugin to do this.

My pom.xml has:

 <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <configuration> <executable>python3</executable> <workingDirectory>${project.basedir}/src/main/resources/scripts/</workingDirectory> <arguments> <argument>-m</argument> <argument>unittest</argument> <argument>discover</argument> <argument>-p</argument> <argument>'*_test.py'</argument> </arguments> </configuration> <id>python-test</id> <phase>test</phase> <goals> <goal>exec</goal> </goals> </execution> </executions> </plugin>

My project structure is like:

 . ├── pom.xml ├── src │   ├── main │   │   └── resources │   │   ├── scripts │   │   │   ├── __init__.py │   │   │   ├── foo.py │   │   │   ├── foo_test.py

When I try to run it from the root of the project:

 mvn exec:exec@python-test

I get 0 tests executed:

 ---------------------------------------------------------------------- Ran 0 tests in 0.000s OK

But, if I do this manually, it works fine:

 cd src/main/resources/scripts python3 -m unittest discover -p '*_test.py' ... ---------------------------------------------------------------------- Ran 3 tests in 0.010s

What am I doing wrong here?

Thanks in advance!

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

0

Turns out the single quotes on this line were the problem: <argument>'*_test.py'</argument> . The single quotes around the file -p "'*_test.py'" and did not match any files. Removing them fixed the problem.

over 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