swagger-api / swagger-api/swagger-codegen

[Python] Tests not working

Open
#6,192 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Python help wanted Issue: Non-operational
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Generating API clients in a number of languages, Java and Python so far. The Java one is all solid, unit tests running successfully. For the Python one I'm not able to make tests succeed.

I'm getting a lot of errors, such as:

ERROR: Delete the current test run and then create a new test run based on the latest test case version.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
TypeError: make_test_run_current_with_http_info() missing 1 required positional argument: 'id'

Or:

ERROR: Search for test runs associated with test cases, test plans, an test cycles
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)

See errors.txt for the full output.

Swagger-codegen version
io.swagger:swagger-codegen-maven-plugin:2.2.3
Swagger declaration file content or url

api-docs

Command line used for generation
mvn install
<executions>
    <execution>
        <id>generate-python</id>
        <goals>
            <goal>generate</goal>
        </goals>
        <configuration>
            <configOptions>
                <packageName>jama_rest_client</packageName>
                <projectName>jama-rest-client</projectName>
                <packageVersion>${project.version}</packageVersion>
                <packageUrl>https://www.jamaclient.com</packageUrl>
            </configOptions>
            <addCompileSourceRoot>false</addCompileSourceRoot>
            <inputSpec>${swagger-json.dir}/api-docs</inputSpec>
            <language>python</language>
            <output>target/api-client-python</output>
            <skipOverwrite>false</skipOverwrite>
        </configuration>
    </execution>
</executions>
Steps to reproduce
  1. Run Codegen: mvn install

  2. Traverse to the output folder: cd target/api-client-python

  3. Create a virtual environment:

     virtualenv api-client-python
     pip install -r requirements.txt -r test-requirements.txt
    
  4. Run the tests:

     nosetests tests/*
    

By the way, I'm running this in a Docker container, for optimal isolation, but I won't bother you with those steps (yet), since it seems (so far) unrelated.

Related issues/PRs

None found.

Suggest a fix/enhancement

N/A yet.


Thank you.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with errors.txt and the generated files under target/api-client-python, focusing on the failing tests in tests/* and the missing method arguments shown in the traceback. Reproduce with mvn install, install the listed requirements, and run nosetests tests/*. Done means the generated Python client's test suite completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.