forked from open-telemetry/opentelemetry-python-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add eachdist and move tox to root folder (open-telemetry#29)
Move tox and other configuration files to root folder. Add eachdist to make it easier to handle operations with different packages. The eachdist is taken from opentelemetry but slighty modified to avoid ignoring a given path.
- Loading branch information
0 parents
commit e10ce4b
Showing
3 changed files
with
596 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"""Test script to check given paths for valid README.rst files.""" | ||
import argparse | ||
import sys | ||
from pathlib import Path | ||
|
||
import readme_renderer.rst | ||
|
||
|
||
def is_valid_rst(path): | ||
"""Checks if RST can be rendered on PyPI.""" | ||
with open(path) as readme_file: | ||
markup = readme_file.read() | ||
return readme_renderer.rst.render(markup) is not None | ||
|
||
|
||
def parse_args(): | ||
parser = argparse.ArgumentParser( | ||
description="Checks README.rst file in path for syntax errors." | ||
) | ||
parser.add_argument( | ||
"paths", nargs="+", help="paths containing a README.rst to test" | ||
) | ||
parser.add_argument("-v", "--verbose", action="store_true") | ||
return parser.parse_args() | ||
|
||
|
||
def main(): | ||
args = parse_args() | ||
error = False | ||
|
||
for path in map(Path, args.paths): | ||
readme = path / "README.rst" | ||
try: | ||
if not is_valid_rst(readme): | ||
error = True | ||
print("FAILED: RST syntax errors in", readme) | ||
continue | ||
except FileNotFoundError: | ||
error = True | ||
print("FAILED: README.rst not found in", path) | ||
continue | ||
if args.verbose: | ||
print("PASSED:", readme) | ||
|
||
if error: | ||
sys.exit(1) | ||
print("All clear.") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
function cov { | ||
pytest \ | ||
--ignore-glob=*/setup.py \ | ||
--cov ${1} \ | ||
--cov-append \ | ||
--cov-branch \ | ||
--cov-report='' \ | ||
${1} | ||
} | ||
|
||
|
||
coverage erase | ||
|
||
coverage report | ||
coverage xml |
Oops, something went wrong.