OpenAPITools / OpenAPITools/openapi-generator

[REQ] Improve python test coverage

Open
#19,409 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

The currently generated python code has a relatively low test coverage:

image
image

I think it would make sense to generate additional tests to improve the coverage especially for:

api_client.py ApiClient class
configuration.py Configuration class
exceptions.py all exception classes
rest.py RESTClientObject and RESTResponse class
default_api.py DefaultApi class

generated models: to_str, to_json, to_dict and from_dict methods

Describe the solution you'd like

Additional automatically generated tests that cover the files and classes mentioned above.

Additional context

This is the openapi.json file used for this code:
example_openapi.json

This is how the code was generated

docker run --rm -v "PATH_TO_REPO:/local" openapitools/openapi-generator-cli generate -i /local/omnitracker_service/example_openapi.json -g python -o /local/omnitracker_service/generated_code --additional-properties=packageName=omnitracker_openapi_client

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 example_openapi.json and the Docker generation command, then inspect generated api_client.py, configuration.py, exceptions.py, rest.py and default_api.py. Review the generated model methods to identify the requested test coverage. Done means the generated Python client has tests covering these classes, exception types, REST behavior and model serialization methods.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, python
Domain
api, testing, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.