Skip to content

Commit

Permalink
dmypy: warn instead of failing if report generation is configured (py…
Browse files Browse the repository at this point in the history
…thon#10181)

### Description
Log a warning instead of failing when `dmypy run` is called on a project that has report generation configured via setup.cfg

Resolves python#10118 

## Test Plan

1. Built package locally
2. Installed into my virtualenv
3. Created test project with mypy.ini contents:
    ```ini
    [mypy]
    html_report = build/html
    ```
1. Ran `dmypy run .`

Result:

```
dmypy run .
dmypy: ignoring report generation settings. Start/restart cannot generate reports.
Daemon started
```
  • Loading branch information
natemcmaster committed Mar 19, 2022
1 parent 8c8d169 commit 8d02b47
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mypy/dmypy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ def process_start_options(flags: List[str], allow_sources: bool) -> Options:
['-i'] + flags, require_targets=False, server_options=True
)
if options.report_dirs:
sys.exit("dmypy: start/restart cannot generate reports")
print("dmypy: Ignoring report generation settings. Start/restart cannot generate reports.")
if options.junit_xml:
sys.exit("dmypy: start/restart does not support --junit-xml; "
"pass it to check/recheck instead")
print("dmypy: Ignoring report generation settings. "
"Start/restart does not support --junit-xml. Pass it to check/recheck instead")
options.junit_xml = None
if not options.incremental:
sys.exit("dmypy: start/restart should not disable incremental mode")
if options.follow_imports not in ('skip', 'error', 'normal'):
Expand Down

0 comments on commit 8d02b47

Please sign in to comment.