ci: fix test

This commit is contained in:
Florian Bezannier
2022-04-25 23:11:11 +02:00
parent d941e01882
commit 93aadfb6f2
6 changed files with 36 additions and 9 deletions
+4 -3
View File
@@ -11,7 +11,6 @@ jobs:
test:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Set up python
id: setup-python
uses: actions/setup-python@v2
@@ -21,6 +20,7 @@ jobs:
uses: snok/install-poetry@v1
with:
virtualenvs-in-project: true
- uses: actions/checkout@v2
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
@@ -40,6 +40,7 @@ jobs:
run: |
echo Test
source .venv/bin/activate
coverage run -m unittest || exit 1
coverage run -m unittest || exit 11
coverage combine
coverage report
[ -n "$CODACY_PROJECT_TOKEN" ] && coverage combine && coverage xml -o cobertura.xml && bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r cobertura.xml
[ -n "$CODACY_PROJECT_TOKEN" ] && coverage xml -o cobertura.xml && bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r cobertura.xml
+3 -3
View File
@@ -1,11 +1,11 @@
# Developer Information
## Contributing
## Contributing
Before create a pull request check your code with Prospector.
Before creating a pull request check your code with Prospector.
You can install it with
```
poetry install --no-root```
poetry install --no-root
#Then in the root of the git project:
prospector
```
View File
+9
View File
@@ -0,0 +1,9 @@
[General]
currency =
[Electricity config]
day price = 0.1853
night price = 0.1353
night hour start = 22h30
night hour end = 6h00
+15
View File
@@ -0,0 +1,15 @@
{
"abrp": {
"token": null
},
"client_id": "cid",
"client_secret": "csec",
"co2_signal_api": null,
"country_code": "FR",
"customer_id": "AP-ACNT1234",
"proxies": null,
"realm": "clientsB2CPeugeot",
"refresh_token": "aasds-aaa",
"remote_refresh_token": "aa",
"weather_api": null
}
+5 -3
View File
@@ -22,20 +22,22 @@ from psa_car_controller.psacc.application.charge_control import ChargeControl
# 2022-04-20 12:31:15,552 :: INFO :: Approaching scheduled charging time, but should not charge. Postponing charge hour!
# 2022-04-20 12:31:15,552 :: INFO :: Changing stop_hour to 11:0
class MyTestCase(unittest.TestCase):
def test_something(self):
class TestChargeControl(unittest.TestCase):
def test_charge_control(self):
my_logger()
ChargeControl.MQTT_TIMEOUT = 0
now = datetime.datetime.now()
stop_hour = now + datetime.timedelta(minutes=2)
vin = "123"
percentage_threshold = 70
state = {
"charging": True,
"stop_hour": [now.hour, now.minute + 2]
"stop_hour": [stop_hour.hour, stop_hour.minute]
}
expectations = {