Skip to content

Commit e76db2c

Browse files
authored
Add codecov.io to test suite (#851)
1 parent 89e3bd4 commit e76db2c

File tree

5 files changed

+44
-26
lines changed

5 files changed

+44
-26
lines changed

.github/workflows/tests.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,14 @@ jobs:
7171
run: |
7272
source /tmp/pyjanitor-dev_env/bin/activate
7373
python -m pip install -e .
74-
pytest
75-
76-
# - name: Inspect coverage
77-
# run: |
78-
# cat coverage.xml
74+
make test
7975
76+
# https://github.com/codecov/codecov-action
8077
- name: Upload code coverage
81-
run: |
82-
source /tmp/pyjanitor-dev_env/bin/activate
83-
bash <(curl -s https://codecov.io/bash)
78+
uses: codecov/codecov-action@v2
79+
with:
80+
fail_ci_if_error: true # optional (default = false)
81+
verbose: true # optional (default = false)
8482

8583
jupyter-notebook:
8684
name: Execute all Jupyter notebooks
@@ -125,7 +123,6 @@ jobs:
125123
- name: Unpack environment and activate it
126124
run: bash scripts/ci/unpack_environment.sh
127125

128-
129126
- name: Build docs
130127
run: |
131128
source /tmp/pyjanitor-dev_env/bin/activate

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ format:
2020

2121
test:
2222
@echo "Running test suite..."
23-
pytest --cov-report html
23+
pytest
2424

2525
lint:
2626
@echo "Checking code formatting..."

pyproject.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,20 @@ ignore-private = false
2828
ignore-semiprivate = false
2929
quiet = false
3030
verbose = 2
31+
32+
# https://docs.pytest.org/en/6.2.x/mark.html#registering-marks
33+
[tool.pytest.ini_options]
34+
addopts = "--cov=janitor/ --cov-report=html --cov-report=xml --cov-report=term-missing"
35+
markers = [
36+
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
37+
"biology",
38+
"chemistry",
39+
"engineering",
40+
"finance",
41+
"functions: main janitor functions suite",
42+
"ml: Machine learning-specific data cleaning functions.",
43+
"spark_functions",
44+
"timeseries",
45+
"utils",
46+
"xarray",
47+
]

tests/finance/test_convert_stock.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
from janitor.finance import get_symbol
2+
import pytest
23

3-
"""
4-
Tests get_symbol function,
5-
get_symbol should return appropriate string
6-
corresponding to abbreviation.
7-
This string will be a company's full name,
8-
and the abbreviation will be the NSYE
9-
symbol for the company.
104

11-
Example:
12-
print(get_symbol("aapl"))
13-
console >> Apple Inc.
14-
15-
If the symbol does not have a corresponding
16-
company, Nonetype should be returned.
17-
18-
"""
5+
@pytest.mark.xfail(reason="Flaky because it depends on internet connectivity.")
6+
def test_convert_stock():
7+
"""
8+
Tests get_symbol function,
9+
get_symbol should return appropriate string
10+
corresponding to abbreviation.
11+
This string will be a company's full name,
12+
and the abbreviation will be the NSYE
13+
symbol for the company.
1914
15+
Example:
16+
print(get_symbol("aapl"))
17+
console >> Apple Inc.
2018
21-
def test_convert_stock():
19+
If the symbol does not have a corresponding
20+
company, Nonetype should be returned.
21+
"""
2222
assert get_symbol("GME") == "GameStop Corp."
2323
assert get_symbol("AAPL") != "Aramark"
2424
assert get_symbol("ASNF") is None

tests/finance/test_get_symbol.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from janitor.finance import get_symbol
2+
import pytest
23

34
"""
45
tests the convert_symbol helper function.
@@ -13,6 +14,9 @@
1314
"""
1415

1516

17+
@pytest.mark.xfail(
18+
reason="Flaky, because it depends on internet connectivity."
19+
)
1620
def test_get_symbol():
1721
assert get_symbol("GME") == "GameStop Corp."
1822
assert get_symbol("GME") != "Globus Medical Inc."

0 commit comments

Comments
 (0)