Skip to content

Commit 0f3dbe6

Browse files
committed
Update tests
1 parent 6449115 commit 0f3dbe6

File tree

3 files changed

+27
-26
lines changed

3 files changed

+27
-26
lines changed

tests/commands/test_lib_complex.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from platformio.util import strip_ansi_codes
2424

2525
PlatformioCLI.leftover_args = ["--json-output"] # hook for click
26+
ARDUINO_JSON_VERSION = "6.21.5"
2627

2728

2829
def test_search(clirunner, validate_cliresult):
@@ -44,10 +45,10 @@ def test_global_install_registry(clirunner, validate_cliresult, isolated_pio_cor
4445
"-g",
4546
"install",
4647
"64",
47-
"ArduinoJson@~5.10.0",
48-
"547@2.2.4",
48+
"ArduinoJson@~6",
49+
"547@2.7.3",
4950
"AsyncMqttClient@<=0.8.2",
50-
"Adafruit PN532@1.2.0",
51+
"Adafruit PN532@1.3.2",
5152
],
5253
)
5354
validate_cliresult(result)
@@ -60,7 +61,7 @@ def test_global_install_registry(clirunner, validate_cliresult, isolated_pio_cor
6061
items1 = [d.basename for d in isolated_pio_core.join("lib").listdir()]
6162
items2 = [
6263
"ArduinoJson",
63-
"ArduinoJson@5.10.1",
64+
"fArduinoJson@{ARDUINO_JSON_VERSION}",
6465
"NeoPixelBus",
6566
"AsyncMqttClient",
6667
"ESPAsyncTCP",
@@ -79,7 +80,7 @@ def test_global_install_archive(clirunner, validate_cliresult, isolated_pio_core
7980
"install",
8081
"https://github.com/bblanchon/ArduinoJson/archive/v5.8.2.zip",
8182
"https://github.com/bblanchon/ArduinoJson/archive/v5.8.2.zip@5.8.2",
82-
"SomeLib=https://dl.registry.platformio.org/download/milesburton/library/DallasTemperature/3.8.1/DallasTemperature-3.8.1.tar.gz",
83+
"SomeLib=https://dl.registry.platformio.org/download/milesburton/library/DallasTemperature/3.11.0/DallasTemperature-3.11.0.tar.gz",
8384
"https://github.com/Pedroalbuquerque/ESP32WebServer/archive/master.zip",
8485
],
8586
)
@@ -142,7 +143,7 @@ def test_install_duplicates( # pylint: disable=unused-argument
142143
[
143144
"-g",
144145
"install",
145-
"https://dl.registry.platformio.org/download/milesburton/library/DallasTemperature/3.8.1/DallasTemperature-3.8.1.tar.gz",
146+
"https://dl.registry.platformio.org/download/milesburton/library/DallasTemperature/3.11.0/DallasTemperature-3.11.0.tar.gz",
146147
],
147148
)
148149
validate_cliresult(result)
@@ -176,11 +177,11 @@ def test_global_lib_list(clirunner, validate_cliresult):
176177
n in result.output
177178
for n in (
178179
"required: https://github.com/Pedroalbuquerque/ESP32WebServer/archive/master.zip",
179-
"ArduinoJson @ 5.10.1",
180+
f"ArduinoJson @ {ARDUINO_JSON_VERSION}",
180181
"required: git+https://github.com/gioblu/PJON.git#3.0",
181182
"PJON @ 3.0.0+sha.1fb26f",
182183
)
183-
)
184+
), result.output
184185

185186
result = clirunner.invoke(cmd_lib, ["-g", "list", "--json-output"])
186187
assert all(
@@ -220,7 +221,7 @@ def test_global_lib_list(clirunner, validate_cliresult):
220221
"ArduinoJson@5.8.2",
221222
"ArduinoJson@5.10.1",
222223
"AsyncMqttClient@0.8.2",
223-
"NeoPixelBus@2.2.4",
224+
"NeoPixelBus@2.7.3",
224225
"PJON@6.2.0+sha.07fe9aa",
225226
"PJON@3.0.0+sha.1fb26fd",
226227
"PubSubClient@2.6.0+sha.bef5814",
@@ -249,7 +250,7 @@ def test_global_lib_update(clirunner, validate_cliresult):
249250
assert "__pkg_dir" in oudated[0]
250251
result = clirunner.invoke(cmd_lib, ["-g", "update", oudated[0]["__pkg_dir"]])
251252
validate_cliresult(result)
252-
assert "Removing NeoPixelBus @ 2.2.4" in strip_ansi_codes(result.output)
253+
assert "Removing NeoPixelBus @ 2.7.3" in strip_ansi_codes(result.output)
253254

254255
# update all libraries
255256
result = clirunner.invoke(

tests/commands/test_platform.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,19 @@ def test_install_unknown_from_registry(clirunner):
6363
def test_install_core_3_dev_platform(clirunner, validate_cliresult, isolated_pio_core):
6464
result = clirunner.invoke(
6565
cli_platform.platform_install,
66-
["atmelavr@1.2.0", "--skip-default-package"],
66+
["atmelavr@2.2.0", "--skip-default-package"],
6767
)
6868
assert result.exit_code == 0
6969

7070

7171
def test_install_known_version(clirunner, validate_cliresult, isolated_pio_core):
7272
result = clirunner.invoke(
7373
cli_platform.platform_install,
74-
["atmelavr@2.0.0", "--skip-default-package", "--with-package", "tool-avrdude"],
74+
["atmelavr@4.2.0", "--skip-default-package", "--with-package", "tool-avrdude"],
7575
)
7676
validate_cliresult(result)
7777
output = strip_ansi_codes(result.output)
78-
assert "atmelavr @ 2.0.0" in output
78+
assert "atmelavr@4.2.0" in output
7979
assert not os.path.isdir(str(isolated_pio_core.join("packages")))
8080

8181

@@ -128,14 +128,14 @@ def test_update_raw(clirunner, validate_cliresult, isolated_pio_core):
128128
result = clirunner.invoke(cli_platform.platform_update, ["atmelavr"])
129129
validate_cliresult(result)
130130
output = strip_ansi_codes(result.output)
131-
assert "Removing atmelavr @ 2.0.0" in output
131+
assert "Removing atmelavr @ 4.2.0" in output
132132
assert "Platform Manager: Installing platformio/atmelavr @" in output
133133
assert len(isolated_pio_core.join("packages").listdir()) == 2
134134

135135

136136
def test_uninstall(clirunner, validate_cliresult, isolated_pio_core):
137137
result = clirunner.invoke(
138-
cli_platform.platform_uninstall, ["atmelavr@1.2.0", "atmelavr", "espressif8266"]
138+
cli_platform.platform_uninstall, ["atmelavr@2.2.0", "atmelavr", "espressif8266"]
139139
)
140140
validate_cliresult(result)
141141
assert not isolated_pio_core.join("platforms").listdir()

tests/package/test_manager.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def test_install_from_registry(isolated_pio_core, tmpdir_factory):
219219
# test conflicted names
220220
lm = LibraryPackageManager(str(tmpdir_factory.mktemp("conflicted-storage")))
221221
lm.set_log_level(logging.ERROR)
222-
lm.install("z3t0/IRremote@2.6.1")
222+
lm.install("z3t0/IRremote")
223223
lm.install("mbed-yuhki50/IRremote")
224224
assert len(lm.get_installed()) == 2
225225

@@ -554,14 +554,14 @@ def test_uninstall(isolated_pio_core, tmpdir_factory):
554554
assert not lm.get_installed()
555555

556556
# test uninstall dependencies
557-
assert lm.install("AsyncMqttClient-esphome @ 0.8.4")
557+
assert lm.install("AsyncMqttClient-esphome")
558558
assert len(lm.get_installed()) == 3
559559
assert lm.uninstall("AsyncMqttClient-esphome", skip_dependencies=True)
560560
assert len(lm.get_installed()) == 2
561561

562562
lm = LibraryPackageManager(str(storage_dir))
563563
lm.set_log_level(logging.ERROR)
564-
assert lm.install("AsyncMqttClient-esphome @ 0.8.4")
564+
assert lm.install("AsyncMqttClient-esphome")
565565
assert lm.uninstall("AsyncMqttClient-esphome")
566566
assert not lm.get_installed()
567567

@@ -604,23 +604,23 @@ def test_update_with_metadata(isolated_pio_core, tmpdir_factory):
604604
assert str(outdated.current) == "1.8.7"
605605
assert outdated.latest > semantic_version.Version("1.10.0")
606606

607-
pkg = lm.install("ArduinoJson @ 5.10.1")
607+
pkg = lm.install("ArduinoJson @ 6.19.4")
608608
# test latest
609609
outdated = lm.outdated(pkg)
610-
assert str(outdated.current) == "5.10.1"
610+
assert str(outdated.current) == "6.19.4"
611611
assert outdated.wanted is None
612612
assert outdated.latest > outdated.current
613613
assert outdated.latest > semantic_version.Version("5.99.99")
614614

615615
# test wanted
616-
outdated = lm.outdated(pkg, PackageSpec("ArduinoJson@~5"))
617-
assert str(outdated.current) == "5.10.1"
618-
assert str(outdated.wanted) == "5.13.4"
616+
outdated = lm.outdated(pkg, PackageSpec("ArduinoJson@~6"))
617+
assert str(outdated.current) == "6.19.4"
618+
assert str(outdated.wanted) == "6.21.5"
619619
assert outdated.latest > semantic_version.Version("6.16.0")
620620

621-
# update to the wanted 5.x
622-
new_pkg = lm.update("ArduinoJson@^5", PackageSpec("ArduinoJson@^5"))
623-
assert str(new_pkg.metadata.version) == "5.13.4"
621+
# update to the wanted 6.x
622+
new_pkg = lm.update("ArduinoJson@^6", PackageSpec("ArduinoJson@^6"))
623+
assert str(new_pkg.metadata.version) == "6.21.5"
624624
# check that old version is removed
625625
assert len(lm.get_installed()) == 2
626626

0 commit comments

Comments
 (0)