我目前正在为Python编写单元测试,为此我使用了内置的“unittest”模块和一个名为“coverage”的外部库的组合。
在Windows上生成报告时,我得到以下输出:
C:\Users\Me\Project> coverage report --include package/*
...
package\tests\scanner.py 53 0 100%
package\tests\scans.py 169 32 81% 202-235
---------------------------------------------------------------------------
TOTAL 1344 336 75%
然而,当我在基于Linux的机器上部署它时,会发生这种情况:
$ coverage report --include package/*
Name Stmts Miss Cover Missing
-------------------------------------
No data to report.
ERROR: Job failed: exit code 1
如果我使用以下内容,它会找到文件,但在嵌套文件中找不到任何文件:
$ coverage report -m package/**/*.py
有谁知道如何解决这个问题?
答案 0 :(得分:0)
这似乎是与Bash中的通配符相关的问题。做了以下工作:
var json = {
"dataUpdatedTime" : "2017-07-11T15:47:00+03:00",
"weatherStations" : [ {
"id" : 2050,
"measuredTime" : "2017-07-11T15:44:00+03:00",
"sensorValues" : [ {
"id" : 1,
"roadStationId" : 2050,
"name" : "ILMA",
"oldName" : "airtemperature1",
"shortName" : "Ilma ",
"sensorValue" : 18.2,
"sensorUnit" : "°C"
}, {
"id" : 2,
"roadStationId" : 2050,
"name" : "ILMA_DERIVAATTA",
"oldName" : "airtemperature1change",
"shortName" : "DIlm",
"sensorValue" : 0.2,
"sensorUnit" : "°C/h"
}, {
"id" : 3,
"roadStationId" : 2050,
"name" : "TIE_1",
"oldName" : "roadsurfacetemperature1",
"shortName" : "Tie1 ",
"sensorValue" : 20.5,
"sensorUnit" : "°C"
}, {
"id" : 4,
"roadStationId" : 2050,
"name" : "TIE_1_DERIVAATTA",
"oldName" : "roadsurfacetemperature1change",
"shortName" : "DTie1",
"sensorValue" : -0.2,
"sensorUnit" : "°C/h"
}, {
"id" : 5,
"roadStationId" : 2050,
"name" : "TIE_2",
"oldName" : "roadsurfacetemperature2",
"shortName" : "Tie2",
"sensorValue" : 20.7,
"sensorUnit" : "°C"
}, {
"id" : 6,
"roadStationId" : 2050,
"name" : "TIE_2_DERIVAATTA",
"oldName" : "roadsurfacetemperature2change",
"shortName" : "DTie2",
"sensorValue" : -0.4,
"sensorUnit" : "°C/h"
}, {
"id" : 7,
"roadStationId" : 2050,
"name" : "MAA_1",
"oldName" : "groundtemperature1",
"shortName" : "Maa1",
"sensorValue" : 21.4,
"sensorUnit" : "°C"
}, {
"id" : 8,
"roadStationId" : 2050,
"name" : "MAA_2",
"oldName" : "groundtemperature2",
"shortName" : "Maa2",
"sensorValue" : 21.7,
"sensorUnit" : "°C"
}, {
"id" : 9,
"roadStationId" : 2050,
"name" : "KASTEPISTE",
"oldName" : "dewpoint",
"shortName" : "KastP",
"sensorValue" : 14.5,
"sensorUnit" : "°C"
}, {
"id" : 10,
"roadStationId" : 2050,
"name" : "JAATYMISPISTE_1",
"oldName" : "freezingpoint1",
"shortName" : "JääPi1",
"sensorValue" : 0.0,
"sensorUnit" : "°C"
}, {
"id" : 11,
"roadStationId" : 2050,
"name" : "JAATYMISPISTE_2",
"oldName" : "freezingpoint2",
"shortName" : "JääPi2",
"sensorValue" : -0.1,
"sensorUnit" : "°C"
}, {
"id" : 16,
"roadStationId" : 2050,
"name" : "KESKITUULI",
"oldName" : "averagewindspeed",
"shortName" : "KTuuli",
"sensorValue" : 1.5,
"sensorUnit" : "m/s"
}, {
"id" : 18,
"roadStationId" : 2050,
"name" : "TUULENSUUNTA",
"oldName" : "winddirection",
"shortName" : "TSuunt",
"sensorValue" : 97.0,
"sensorUnit" : "°"
}, {
"id" : 21,
"roadStationId" : 2050,
"name" : "ILMAN_KOSTEUS",
"oldName" : "humidity",
"shortName" : "Koste",
"sensorValue" : 79.0,
"sensorUnit" : "%"
}, {
"id" : 22,
"roadStationId" : 2050,
"name" : "SADE",
"oldName" : "precipitation",
"shortName" : "Sade",
"sensorValue" : 0.0,
"sensorUnit" : "///",
"sensorValueDescriptionFi" : "Pouta",
"sensorValueDescriptionEn" : "Dry weather"
}, {
"id" : 23,
"roadStationId" : 2050,
"name" : "SADE_INTENSITEETTI",
"oldName" : "precipitationintensity",
"shortName" : "S-Int",
"sensorValue" : 0.0,
"sensorUnit" : "mm/h"
}, {
"id" : 24,
"roadStationId" : 2050,
"name" : "SADESUMMA",
"oldName" : "precipitationsum",
"shortName" : "S-Sum",
"sensorValue" : 0.3,
"sensorUnit" : "mm"
}, {
"id" : 25,
"roadStationId" : 2050,
"name" : "SATEEN_OLOMUOTO_PWDXX",
"oldName" : "precipitationtype",
"shortName" : "S-Olom",
"sensorValue" : 7.0,
"sensorUnit" : "///",
"sensorValueDescriptionFi" : "Pouta",
"sensorValueDescriptionEn" : "Dry weather"
}, {
"id" : 26,
"roadStationId" : 2050,
"name" : "NAKYVYYS",
"oldName" : "visibility",
"shortName" : "Näk_km",
"sensorValue" : 2.0,
"sensorUnit" : "km"
}, {
"id" : 27,
"roadStationId" : 2050,
"name" : "KELI_1",
"oldName" : "roadsurfaceconditions1",
"shortName" : "Keli1",
"sensorValue" : 1.0,
"sensorUnit" : "***",
"sensorValueDescriptionFi" : "Kuiva",
"sensorValueDescriptionEn" : "Dry"
}, {
"id" : 28,
"roadStationId" : 2050,
"name" : "KELI_2",
"oldName" : "roadsurfaceconditions2",
"shortName" : "Keli2",
"sensorValue" : 1.0,
"sensorUnit" : "***",
"sensorValueDescriptionFi" : "Kuiva",
"sensorValueDescriptionEn" : "Dry"
}, {
"id" : 29,
"roadStationId" : 2050,
"name" : "VAROITUS_1",
"oldName" : "warning1",
"shortName" : "Varo1",
"sensorValue" : 0.0,
"sensorUnit" : "???",
"sensorValueDescriptionFi" : "OK",
"sensorValueDescriptionEn" : "OK"
}, {
"id" : 30,
"roadStationId" : 2050,
"name" : "VAROITUS_2",
"oldName" : "warning2",
"shortName" : "Varo2",
"sensorValue" : 0.0,
"sensorUnit" : "???",
"sensorValueDescriptionFi" : "OK",
"sensorValueDescriptionEn" : "OK"
}, {
"id" : 31,
"roadStationId" : 2050,
"name" : "JOHTAVUUS_1",
"oldName" : "conductivity1",
"shortName" : "Joht1",
"sensorValue" : 0.0,
"sensorUnit" : "V"
}, {
"id" : 32,
"roadStationId" : 2050,
"name" : "JOHTAVUUS_2",
"oldName" : "conductivity2",
"shortName" : "Joht2",
"sensorValue" : 0.0,
"sensorUnit" : "V"
}, {
"id" : 33,
"roadStationId" : 2050,
"name" : "PINTASIGNAALI_1",
"oldName" : "surfacesignal1",
"shortName" : "PSig1",
"sensorValue" : 1.5,
"sensorUnit" : "V"
}, {
"id" : 34,
"roadStationId" : 2050,
"name" : "PINTASIGNAALI_2",
"oldName" : "surfacesignal2",
"shortName" : "PSig2",
"sensorValue" : 2.3,
"sensorUnit" : "V"
}, {
"id" : 35,
"roadStationId" : 2050,
"name" : "JAATAAJUUS_1",
"oldName" : "icefrequency1",
"shortName" : "JTaaj1",
"sensorValue" : 115.0,
"sensorUnit" : "Hz"
}, {
"id" : 36,
"roadStationId" : 2050,
"name" : "JAATAAJUUS_2",
"oldName" : "icefrequency2",
"shortName" : "JTaaj2",
"sensorValue" : 393.0,
"sensorUnit" : "Hz"
}, {
"id" : 49,
"roadStationId" : 2050,
"name" : "KASTEPISTE_ERO_TIE",
"oldName" : "roaddewpointdifference",
"shortName" : "KpEroT",
"sensorValue" : 6.0,
"sensorUnit" : "°C"
}, {
"id" : 50,
"roadStationId" : 2050,
"name" : "KOSTEUDEN_MAARA_1",
"oldName" : "surfacemoisture1",
"shortName" : "KosMä1",
"sensorValue" : 0.0,
"sensorUnit" : "mm"
}, {
"id" : 51,
"roadStationId" : 2050,
"name" : "KOSTEUDEN_MAARA_2",
"oldName" : "surfacemoisture2",
"shortName" : "KosMä2",
"sensorValue" : 0.0,
"sensorUnit" : "mm"
}, {
"id" : 52,
"roadStationId" : 2050,
"name" : "SUOLAN_MAARA_1",
"oldName" : "saltamount1",
"shortName" : "SuoMä1",
"sensorValue" : 0.0,
"sensorUnit" : "g/m2"
}, {
"id" : 53,
"roadStationId" : 2050,
"name" : "SUOLAN_MAARA_2",
"oldName" : "saltamount2",
"shortName" : "SuoMä2",
"sensorValue" : 0.0,
"sensorUnit" : "g/m2"
}, {
"id" : 54,
"roadStationId" : 2050,
"name" : "SUOLAN_VAKEVYYS_1",
"oldName" : "saltconcentration1",
"shortName" : "SuoVä1",
"sensorValue" : 252.6,
"sensorUnit" : "g/l"
}, {
"id" : 55,
"roadStationId" : 2050,
"name" : "SUOLAN_VAKEVYYS_2",
"oldName" : "saltconcentration2",
"shortName" : "SuoVä2",
"sensorValue" : 391.0,
"sensorUnit" : "g/l"
}, {
"id" : 56,
"roadStationId" : 2050,
"name" : "TURVALLISUUSLAMPO_1",
"oldName" : "safetytemperature1",
"shortName" : "TurLä1",
"sensorValue" : 0.0,
"sensorUnit" : "°C"
}, {
"id" : 57,
"roadStationId" : 2050,
"name" : "TURVALLISUUSLAMPO_2",
"oldName" : "safetytemperature2",
"shortName" : "TurLä2",
"sensorValue" : -0.1,
"sensorUnit" : "°C"
}, {
"id" : 58,
"roadStationId" : 2050,
"name" : "NAKYVYYS_METRIA",
"oldName" : "visibilitymeters",
"shortName" : "Näky_m",
"sensorValue" : 2000.0,
"sensorUnit" : "m"
}, {
"id" : 98,
"roadStationId" : 2050,
"name" : "AURINKOUP",
"oldName" : "sunup",
"shortName" : "Aurink",
"sensorValue" : 1.0,
"sensorUnit" : "???"
}, {
"id" : 99,
"roadStationId" : 2050,
"name" : "VALOISAA",
"oldName" : "bright",
"shortName" : "Valoa?",
"sensorValue" : 1.0,
"sensorUnit" : "???"
}, {
"id" : 100,
"roadStationId" : 2050,
"name" : "VALLITSEVA_SAA",
"oldName" : "VALLITSEVA_SAA",
"shortName" : "Säätila",
"sensorValue" : 81.0,
"sensorUnit" : "///"
}, {
"id" : 130,
"roadStationId" : 2050,
"name" : "KUITUVASTE_PIENI_1",
"oldName" : "fiberresponsesmall1",
"shortName" : "KVaP1 ",
"sensorValue" : 0.0,
"sensorUnit" : "###"
}, {
"id" : 131,
"roadStationId" : 2050,
"name" : "KUITUVASTE_PIENI_2",
"oldName" : "fiberresponsesmall2",
"shortName" : "KVaP2 ",
"sensorValue" : 0.0,
"sensorUnit" : "###"
}, {
"id" : 132,
"roadStationId" : 2050,
"name" : "KUITUVASTE_SUURI_1",
"oldName" : "fiberresponsebig1",
"shortName" : "KVaS1 ",
"sensorValue" : 0.0,
"sensorUnit" : "###"
}, {
"id" : 133,
"roadStationId" : 2050,
"name" : "KUITUVASTE_SUURI_2",
"oldName" : "fiberresponsebig2",
"shortName" : "KVaS2 ",
"sensorValue" : 0.0,
"sensorUnit" : "###"
} ]
} ]
}
var windDirection = 18;
var item = json.weatherStations[0].sensorValues.find((i) => i.id== windDirection)
console.log(item)