Skip to content

Commit 3708a04

Browse files
committed
[cdd/tests/test_sqlalchemy/test_parse_sqlalchemy_utils.py] Increase test coverage ; [cdd/__init__.py] Bump version ; [.github/workflows/main.yml] Test coverage for 3.6 also ; use python -m pip everywhere over pip
1 parent 14ccebd commit 3708a04

3 files changed

Lines changed: 39 additions & 8 deletions

File tree

‎.github/workflows/main.yml‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,19 @@ jobs:
3737
run: |
3838
python -m pip install --upgrade pip
3939
python -m pip install --upgrade setuptools wheel
40-
pip install -r requirements.txt
40+
python -m pip install -r requirements.txt
4141
- name: Test with unittest
4242
run: |
4343
python setup.py test
44+
- name: Test coverage
45+
run: |
46+
python -m pip install codecov coverage
47+
coverage run -m unittest discover
48+
env
49+
bash <(curl --proto '=https' --tlsv1.2 -sSf https://codecov.io/bash)
50+
env:
51+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
52+
if: matrix.os.name == 'Linux' && github.ref == 'refs/heads/master'
4453
test:
4554
name: ${{ matrix.os.name }} ${{ matrix.python-version }}
4655
runs-on: ${{ matrix.os.runs-on }}
@@ -68,24 +77,24 @@ jobs:
6877
run: |
6978
python -m pip install --upgrade pip
7079
python -m pip install --upgrade setuptools wheel
71-
pip install -r requirements.txt
80+
python -m pip install -r requirements.txt
7281
- name: Test with unittest
7382
run: |
7483
python setup.py test
7584
7685
- name: Lint with flake8
7786
run: |
78-
pip install flake8
87+
python -m pip install flake8
7988
flake8 . --count --select=$(printf '%s,' {A..Z}) --ignore='F811,W503,E203' --show-source --max-complexity=13 --max-line-length=119 --statistics
8089
if: matrix.python-version == '3.8' && matrix.os.name == 'Linux' && github.ref == 'refs/heads/master'
8190
- name: Check formatted with black
8291
run: |
83-
pip install black
92+
python -m pip install black
8493
python -m black . --check --extend-exclude 'cdd/tests/mocks/cstify.py'
8594
if: matrix.python-version == '3.8' && matrix.os.name == 'Linux' && github.ref == 'refs/heads/master'
8695
- name: Doc coverage
8796
run: |
88-
pip install interrogate
97+
python -m pip install interrogate
8998
interrogate -e 'cdd/tests/mocks/cstify.py' --generate-badge '.github/doccoverage.svg'
9099
sed -i 's/interrogate/doc coverage/g; s/data-doc c/data-doc-c/g' .github/doccoverage.svg
91100
# Setup git config
@@ -103,7 +112,7 @@ jobs:
103112
if: matrix.python-version == '3.8' && matrix.os.name == 'Linux' && github.ref == 'refs/heads/master'
104113
- name: Test coverage
105114
run: |
106-
pip install codecov coverage
115+
python -m pip install codecov coverage
107116
coverage run -m unittest discover
108117
env
109118
bash <(curl --proto '=https' --tlsv1.2 -sSf https://codecov.io/bash)
@@ -112,7 +121,7 @@ jobs:
112121
if: (matrix.python-version == '3.8' || matrix.python-version == '3.12') && matrix.os.name == 'Linux' && github.ref == 'refs/heads/master'
113122
- name: PyPi release
114123
run: |
115-
pip install twine
124+
python -m pip install twine
116125
python setup.py sdist bdist_wheel
117126
python -m twine upload --repository pypi dist/*
118127
env:

‎cdd/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from logging import getLogger as get_logger
1010

1111
__author__ = "Samuel Marks" # type: str
12-
__version__ = "0.0.99rc35" # type: str
12+
__version__ = "0.0.99rc36" # type: str
1313
__description__ = (
1414
"Open API to/fro routes, models, and tests. "
1515
"Convert between docstrings, classes, methods, argparse, pydantic, and SQLalchemy."

‎cdd/tests/test_sqlalchemy/test_parse_sqlalchemy_utils.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from unittest import TestCase
88

99
from cdd.shared.ast_utils import set_value
10+
from cdd.shared.pure_utils import pp
1011
from cdd.sqlalchemy.utils.parse_utils import (
1112
column_call_name_manipulator,
1213
column_call_to_param,
@@ -88,6 +89,27 @@ def test_column_call_to_param_fk(self) -> None:
8889
self.assertEqual(gold_name, gen_name)
8990
self.assertDictEqual(gold_param, gen_param)
9091

92+
def test_column_call_to_param_from_ast_construct(self) -> None:
93+
"""
94+
Tests that `parse.sqlalchemy.utils.column_call_to_param` works with AST construct
95+
"""
96+
node_with_func_call = deepcopy(node_fk_call)
97+
node_with_func_call.args[-1].func.id = "Foo"
98+
gen_name, gen_param = column_call_to_param(node_with_func_call)
99+
gold_name, gold_param = (
100+
lambda _name: (
101+
_name,
102+
{
103+
"x_typ": deepcopy(
104+
intermediate_repr_node_pk["params"][_name]["x_typ"]
105+
),
106+
"typ": "Foo('element.element_id')",
107+
},
108+
)
109+
)("primary_element")
110+
self.assertEqual(gold_name, gen_name)
111+
self.assertDictEqual(gold_param, gen_param)
112+
91113
def test_get_pk_and_type(self) -> None:
92114
"""
93115
Tests get_pk_and_type

0 commit comments

Comments
 (0)