Skip to content

Commit

Permalink
Skip folders on html report, refs #11334 (#11338)
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn authored Oct 14, 2021
1 parent a114826 commit d807e09
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mypy/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,8 @@ def on_file(self,
except ValueError:
return

if should_skip_path(path):
return
if should_skip_path(path) or os.path.isdir(path):
return # `path` can sometimes be a directory, see #11334

visitor = stats.StatisticsVisitor(inferred=True,
filename=tree.fullname,
Expand Down
38 changes: 38 additions & 0 deletions test-data/unit/reports.test
Original file line number Diff line number Diff line change
Expand Up @@ -456,3 +456,41 @@ DisplayToSource = Callable[[int], int]
</table>
</body>
</html>

[case testHtmlReportOnNamespacePackagesWithExplicitBases]
# cmd: mypy --html-report report -p folder
[file folder/subfolder/something.py]
class Something:
pass
[file folder/main.py]
from .subfolder.something import Something
print(Something())
[file folder/__init__.py]
[file mypy.ini]
\[mypy]
explicit_package_bases = True
namespace_packages = True

[file report/mypy-html.css]
[file report/index.html]
[outfile report/html/folder/subfolder/something.py.html]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../../mypy-html.css">
</head>
<body>
<h2>folder.subfolder.something</h2>
<table>
<caption>folder/subfolder/something.py</caption>
<tbody><tr>
<td class="table-lines"><pre><span id="L1" class="lineno"><a class="lineno" href="#L1">1</a></span>
<span id="L2" class="lineno"><a class="lineno" href="#L2">2</a></span>
</pre></td>
<td class="table-code"><pre><span class="line-precise" title="No Anys on this line!">class Something:</span>
<span class="line-precise" title="No Anys on this line!"> pass</span>
</pre></td>
</tr></tbody>
</table>
</body>
</html>

0 comments on commit d807e09

Please sign in to comment.