forked from codecov/example-python
-
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.
- Loading branch information
1 parent
f6d66c6
commit 111adc3
Showing
8 changed files
with
45 additions
and
2 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
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
from app.calculator import Calculator | ||
from app.projectA.calculator import Calculator | ||
|
||
import unittest | ||
|
||
|
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,15 @@ | ||
py_library( | ||
name="adder", | ||
srcs=["adder.py"], | ||
|
||
) | ||
|
||
py_test( | ||
name="test_adder", | ||
srcs=["test_adder.py"], | ||
deps = [ | ||
"//app/projectB:adder", | ||
] | ||
) | ||
|
||
exports_files(["codecov_wrapper.sh"]) |
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,3 @@ | ||
class Adder: | ||
def add(self, x, y): | ||
return x + y |
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,16 @@ | ||
#/bin/bash | ||
|
||
# `bazel coverage --run_under foo :bar` basically translates to: | ||
# foo pytest --cov bar/src/a.py bar/src/b.py | ||
# We want to run that `pytest` command unmodified, as below: | ||
"$@" | ||
|
||
# codecov doesn't recognise pylcov.dat as a coverage report, renaming it to lcov.dat so codecov can acknowledge it | ||
mv $COVERAGE_DIR/pylcov.dat $COVERAGE_DIR/lcov.dat | ||
|
||
# uploading coverage | ||
codecovcli -v create-commit -t $CODECOV_TOKEN | ||
codecovcli -v create-report -t $CODECOV_TOKEN | ||
codecovcli -v do-upload -t $CODECOV_TOKEN -s $COVERAGE_DIR | ||
|
||
|
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,9 @@ | ||
import unittest | ||
|
||
from app.projectB.adder import Adder | ||
|
||
|
||
|
||
class TestAdder(unittest.TestCase): | ||
def test_adder(self, x, y): | ||
assert x + y == Adder.add(x, y) |