Page MenuHomePhabricator

D8433.id20017.diff
No OneTemporary

D8433.id20017.diff

diff --git a/src/unit/engine/NoseTestEngine.php b/src/unit/engine/NoseTestEngine.php
--- a/src/unit/engine/NoseTestEngine.php
+++ b/src/unit/engine/NoseTestEngine.php
@@ -122,35 +122,15 @@
$classes = $coverage_dom->getElementsByTagName("class");
foreach ($classes as $class) {
- // filename is actually python module path with ".py" at the end,
- // e.g.: tornado.web.py
- $relative_path = explode(".", $class->getAttribute("filename"));
- array_pop($relative_path);
- $relative_path = $source_path .'/'. implode("/", $relative_path);
- $relative_path = Filesystem::readablePath($relative_path);
-
- // first we check if the path is a directory (a Python package), if it is
- // set relative and absolute paths to have __init__.py at the end.
- $absolute_path = Filesystem::resolvePath($relative_path);
- if (is_dir($absolute_path)) {
- $relative_path .= "/__init__.py";
- $absolute_path .= "/__init__.py";
- }
-
- // then we check if the path with ".py" at the end is file (a Python
- // submodule), if it is - set relative and absolute paths to have
- // ".py" at the end.
- if (is_file($absolute_path.".py")) {
- $relative_path .= ".py";
- $absolute_path .= ".py";
- }
+ $path = $class->getAttribute("filename");
+ $root = $this->getWorkingCopy()->getProjectRoot();
- if (!file_exists($absolute_path)) {
+ if (!Filesystem::isDescendant($path, $root)) {
continue;
}
// get total line count in file
- $line_count = count(file($absolute_path));
+ $line_count = count(file($path));
$coverage = "";
$start_line = 1;
@@ -178,7 +158,7 @@
}
}
- $reports[$relative_path] = $coverage;
+ $reports[$path] = $coverage;
}
return $reports;

File Metadata

Mime Type
text/plain
Expires
Wed, Oct 16, 10:43 AM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6717159
Default Alt Text
D8433.id20017.diff (1 KB)

Event Timeline