Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mypy/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,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>