Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

155
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda