Correct tests for decimal points
This commit is contained in:
parent
8f725e033f
commit
d2e4ec97aa
|
@ -13,7 +13,7 @@ def test_temp_collector(monkeypatch):
|
||||||
return 25.345
|
return 25.345
|
||||||
|
|
||||||
monkeypatch.setattr(collector.sense, 'get_temperature', mock_temp)
|
monkeypatch.setattr(collector.sense, 'get_temperature', mock_temp)
|
||||||
assert collector.get_temperature() == 23.0
|
assert collector.get_temperature() == 22.794
|
||||||
|
|
||||||
|
|
||||||
def test_humidity_collector(monkeypatch):
|
def test_humidity_collector(monkeypatch):
|
||||||
|
@ -51,7 +51,7 @@ def test_values_to_db(monkeypatch):
|
||||||
temp = Temperature.objects.get(pk=1)
|
temp = Temperature.objects.get(pk=1)
|
||||||
humidity = Humidity.objects.get(pk=1)
|
humidity = Humidity.objects.get(pk=1)
|
||||||
pressure = Pressure.objects.get(pk=1)
|
pressure = Pressure.objects.get(pk=1)
|
||||||
assert (temp.value == 23.0
|
assert (temp.value == 22.794
|
||||||
and humidity.value == 45
|
and humidity.value == 45
|
||||||
and pressure.value == 1013)
|
and pressure.value == 1013)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1659877975,
|
||||||
|
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1642700792,
|
||||||
|
"narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mach-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils_2",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"pypi-deps-db": [
|
||||||
|
"pypi"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1654084003,
|
||||||
|
"narHash": "sha256-j/XrVVistvM+Ua+0tNFvO5z83isL+LBgmBi9XppxuKA=",
|
||||||
|
"owner": "DavHau",
|
||||||
|
"repo": "mach-nix",
|
||||||
|
"rev": "7e14360bde07dcae32e5e24f366c83272f52923f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"id": "mach-nix",
|
||||||
|
"ref": "3.5.0",
|
||||||
|
"type": "indirect"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1659446231,
|
||||||
|
"narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "eabc38219184cc3e04a974fe31857d8e0eac098d",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-21.11",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pypi": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1661761829,
|
||||||
|
"narHash": "sha256-HmUtNTzLcbf+Tf1V0ibwzzhsvIdeK6NpaPN+JpDiR30=",
|
||||||
|
"owner": "DavHau",
|
||||||
|
"repo": "pypi-deps-db",
|
||||||
|
"rev": "645422a381528e75b7bfced7bcd3b48fd9707828",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "DavHau",
|
||||||
|
"repo": "pypi-deps-db",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"mach-nix": "mach-nix",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"pypi": "pypi"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
{
|
||||||
|
description = "A Python API for various tools I use at work.";
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
|
||||||
|
flake-utils = {
|
||||||
|
url = github:numtide/flake-utils;
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
pypi = {
|
||||||
|
url = "github:DavHau/pypi-deps-db";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
mach-nix = {
|
||||||
|
inputs.pypi-deps-db.follows = "pypi";
|
||||||
|
url = "mach-nix/3.5.0";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils, mach-nix, ... }@inputs:
|
||||||
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
machNix = mach-nix.lib."${system}";
|
||||||
|
devEnvironment = machNix.mkPython {
|
||||||
|
requirements = builtins.readFile ./requirements.txt;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
devShell = pkgs.mkShell {
|
||||||
|
buildInputs = [
|
||||||
|
devEnvironment
|
||||||
|
pkgs.gnumake
|
||||||
|
pkgs.python39Packages.autopep8
|
||||||
|
pkgs.python39Packages.black
|
||||||
|
pkgs.python39Packages.flake8
|
||||||
|
pkgs.python39Packages.jedi
|
||||||
|
pkgs.python39Packages.pip
|
||||||
|
pkgs.python39Packages.yapf
|
||||||
|
];
|
||||||
|
shellHook = ''
|
||||||
|
export DJANGO_SETTINGS_MODULE=sensors.settings.development; \
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
packages.venv = devEnvironment;
|
||||||
|
defaultPackage = (machNix.mkDockerImage {
|
||||||
|
packagesExtra = with pkgs;
|
||||||
|
[ pkgs.bash ];
|
||||||
|
requirements = builtins.readFile ./requirements.txt;
|
||||||
|
_.pytest-cov.propagatedBuildInputs.mod = pySelf: self: oldVal: oldVal ++ [ pySelf.tomli ];
|
||||||
|
}).override
|
||||||
|
(oldAttrs: {
|
||||||
|
name = "environment-sensors";
|
||||||
|
config.Cmd = [ "run.sh" ];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
|
@ -1,10 +1,13 @@
|
||||||
-r base.txt
|
django-background-tasks
|
||||||
|
django==2.2.13
|
||||||
|
gunicorn
|
||||||
mixer
|
mixer
|
||||||
pep8
|
pep8
|
||||||
|
plotly
|
||||||
pylint
|
pylint
|
||||||
pytest
|
pytest
|
||||||
pytest-cov
|
pytest-cov
|
||||||
pytest-django
|
pytest-django
|
||||||
rope
|
rope
|
||||||
sense_emu
|
sense_emu
|
||||||
|
sense_hat
|
|
@ -1,4 +0,0 @@
|
||||||
django==2.2.13
|
|
||||||
django-background-tasks
|
|
||||||
plotly
|
|
||||||
sense_hat
|
|
|
@ -1,3 +0,0 @@
|
||||||
-r base.txt
|
|
||||||
|
|
||||||
gunicorn
|
|
Loading…
Reference in New Issue