Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
Ejecutando "python -m unittest" fallando con maven exec-maven-plugin

Estoy tratando de configurar mi compilación maven para que mvn testejecute mis pruebas de python además de mis pruebas de Java. Estoy tratando de usar el exec-maven-pluginpara hacer esto.

Mi pom.xmltiene:

<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>

La estructura de mi proyecto es como:

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

Cuando trato de ejecutarlo desde la raíz del proyecto:

mvn exec:exec@python-test

Obtengo 0 pruebas ejecutadas:

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

OK

Pero, si hago esto manualmente, funciona bien:

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

¿Qué estoy haciendo mal aquí?

¡Gracias por adelantado!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Resulta que las comillas simples en esta línea eran el problema: <argument>'*_test.py'</argument>. Las comillas simples que envolvían el comparador de archivos se interpretaban como -p "'*_test.py'"y no coincidían con ningún archivo. Eliminarlos solucionó el problema.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!