Skip to content

Commit

Permalink
Move main.py into central folder to generate proper code coverage rep…
Browse files Browse the repository at this point in the history
…ort (#4)

* move main into folder

* add coverage test to integration test

* fix install command
  • Loading branch information
gsheni authored May 10, 2021
1 parent db9fffa commit b4097cc
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install codecov and erase coverage
run: |
python -m pip install "$(cat test-requirements.txt | grep codecov)"
coverage erase
- name: Run Minimum Dependency Generator with 1 file
id: min_dep_gen_1
uses: ./
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
python -m pip install -r requirements.txt
python -m pip install -r test-requirements.txt
coverage erase
make test
make testcoverage
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ FROM python:3.7

ADD minimum_dependency_generator minimum_dependency_generator
ADD requirements.txt requirements.txt
ADD main.py main.py

RUN pip install pip --upgrade --progress-bar off
RUN pip install -r requirements.txt --progress-bar off
ENTRYPOINT ["python", "/main.py"]
ENTRYPOINT ["python", "/minimum_dependency_generator/main.py"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ test: lint

.PHONY: testcoverage
testcoverage: lint
pytest minimum_dependency_generator/ --cov=minimum_dependency_generator --cov-config=../.coveragerc --cache-clear --show-capture=stderr
pytest minimum_dependency_generator/ --cov=minimum_dependency_generator --cov-config=.coveragerc --cache-clear --show-capture=stderr
3 changes: 2 additions & 1 deletion main.py → minimum_dependency_generator/main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from argparse import ArgumentParser
import os

from minimum_dependency_generator import generate_min_requirements


def main():
parser = ArgumentParser(description="reads a requirements file and outputs the minimized requirements")
parser.add_argument('--requirements_paths', nargs='+',
Expand All @@ -17,5 +17,6 @@ def main():
def sanitize_string(s):
return s.replace("%", "%25").replace("\r", "%0D").replace("\n", "%0A")


if __name__ == '__main__':
main()

0 comments on commit b4097cc

Please sign in to comment.