Files
platformio-core/tests/commands/test_ci.py

57 lines
1.9 KiB
Python
Raw Normal View History

# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
2016-08-10 23:00:46 +03:00
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from os.path import join
from platformio.commands.ci import cli as cmd_ci
2018-02-04 01:46:57 +02:00
from platformio.commands.lib import cli as cmd_lib
2016-08-10 23:00:46 +03:00
def test_ci_empty(clirunner):
result = clirunner.invoke(cmd_ci)
2016-08-18 23:51:32 +03:00
assert result.exit_code == 2
assert "Invalid value: Missing argument 'src'" in result.output
2016-08-10 23:00:46 +03:00
def test_ci_boards(clirunner, validate_cliresult):
result = clirunner.invoke(cmd_ci, [
2018-02-04 01:46:57 +02:00
join("examples", "wiring-blink", "src", "main.cpp"), "-b", "uno", "-b",
"leonardo"
2016-08-10 23:00:46 +03:00
])
validate_cliresult(result)
def test_ci_project_conf(clirunner, validate_cliresult):
2018-02-04 01:46:57 +02:00
project_dir = join("examples", "wiring-blink")
2016-08-10 23:00:46 +03:00
result = clirunner.invoke(cmd_ci, [
2018-02-04 01:46:57 +02:00
join(project_dir, "src", "main.cpp"), "--project-conf",
2016-08-10 23:00:46 +03:00
join(project_dir, "platformio.ini")
])
validate_cliresult(result)
2018-02-04 01:46:57 +02:00
assert "uno" in result.output
2016-08-10 23:00:46 +03:00
2018-02-04 01:46:57 +02:00
def test_ci_lib_and_board(clirunner, tmpdir_factory, validate_cliresult):
storage_dir = str(tmpdir_factory.mktemp("lib"))
result = clirunner.invoke(
cmd_lib, ["--storage-dir", storage_dir, "install", "1@2.3.2"])
validate_cliresult(result)
2016-08-10 23:00:46 +03:00
result = clirunner.invoke(cmd_ci, [
2018-02-04 01:46:57 +02:00
join(storage_dir, "OneWire_ID1", "examples", "DS2408_Switch",
2018-01-13 01:19:41 +02:00
"DS2408_Switch.pde"), "-l",
2018-02-04 01:46:57 +02:00
join(storage_dir, "OneWire_ID1"), "-b", "uno"
2016-08-10 23:00:46 +03:00
])
validate_cliresult(result)