|
| 1 | +# This file is part of arduino-cli. |
| 2 | +# |
| 3 | +# Copyright 2020 ARDUINO SA (http://www.arduino.cc/) |
| 4 | +# |
| 5 | +# This software is released under the GNU General Public License version 3, |
| 6 | +# which covers the main part of arduino-cli. |
| 7 | +# The terms of this license can be found at: |
| 8 | +# https://www.gnu.org/licenses/gpl-3.0.en.html |
| 9 | +# |
| 10 | +# You can be released from the requirements of the above licenses by purchasing |
| 11 | +# a commercial license. Buying such a license is mandatory if you want to modify or |
| 12 | +# otherwise use the software for commercial activities involving the Arduino |
| 13 | +# software without disclosing the source code of your own applications. To purchase |
| 14 | +# a commercial license, send an email to [email protected]. |
| 15 | +import os |
| 16 | +import platform |
| 17 | + |
| 18 | + |
| 19 | +def test_cache_clean(run_command): |
| 20 | + """ |
| 21 | + Clean the cache under arduino caching file directory which is |
| 22 | + "<Arduino configure file path>/staging" |
| 23 | + """ |
| 24 | + result = run_command("cache clean") |
| 25 | + assert result.ok |
| 26 | + |
| 27 | + # Generate /staging directory |
| 28 | + result = run_command("lib list") |
| 29 | + assert result.ok |
| 30 | + |
| 31 | + result = run_command("cache clean") |
| 32 | + assert result.ok |
| 33 | + |
| 34 | + running_platform = platform.system() |
| 35 | + homeDir = expanduser("~") |
| 36 | + if running_platform == "Linux": |
| 37 | + assert not (os.path.isdir(homeDir + ".arduino15/staging")) |
| 38 | + elif running_platform == "Darwin": |
| 39 | + assert not (os.path.isdir(homeDir + "Library/Arduino15/staging")) |
| 40 | + elif running_platform == "Windows": |
| 41 | + assert not (os.path.isdir(homeDir + "Arduino15/staging")) |
0 commit comments