Skip to content

Commit

Permalink
create two projects
Browse files Browse the repository at this point in the history
  • Loading branch information
dana-yaish committed Jul 26, 2023
1 parent f6d66c6 commit 111adc3
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/BUILD.bazel → app/projectA/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ py_test(
name="test_calculator",
srcs=["test_calculator.py"],
deps = [
"//app:calculator",
"//app/projectA:calculator",
]
)

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion app/test_calculator.py → app/projectA/test_calculator.py
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

Expand Down
15 changes: 15 additions & 0 deletions app/projectB/BUILD.bazel
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"])
3 changes: 3 additions & 0 deletions app/projectB/adder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Adder:
def add(self, x, y):
return x + y
16 changes: 16 additions & 0 deletions app/projectB/codecov_wrapper.sh
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


9 changes: 9 additions & 0 deletions app/projectB/test_adder.py
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)

0 comments on commit 111adc3

Please sign in to comment.