Skip to content

Commit

Permalink
Add eachdist and move tox to root folder (open-telemetry#29)
Browse files Browse the repository at this point in the history
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
mauriciovasquezbernal authored Apr 9, 2020
0 parents commit e10ce4b
Show file tree
Hide file tree
Showing 3 changed files with 596 additions and 0 deletions.
51 changes: 51 additions & 0 deletions scripts/check_for_valid_readme.py
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()
19 changes: 19 additions & 0 deletions scripts/coverage.sh
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
Loading

0 comments on commit e10ce4b

Please sign in to comment.