LISA is developed and maintained by Microsoft, to empower Linux validation.
Перейти к файлу
Chi Song 4ecf561a5e update license 2021-02-03 08:43:51 +08:00
.github upgrade poetry to latest version 2021-01-28 17:21:27 +08:00
examples Yaml: change Camel case to snake_case in yaml 2021-02-02 07:00:00 +08:00
lisa Yaml: change Camel case to snake_case in yaml 2021-02-02 07:00:00 +08:00
testsuites Yaml: change Camel case to snake_case in yaml 2021-02-02 07:00:00 +08:00
.flake8 Enable cyclomatic complexity checking 2020-09-23 17:36:41 -07:00
.gitattributes limit eol of files to LF, and fix platform bug 2020-08-26 14:10:23 +08:00
.gitignore add support for code coverage 2020-09-17 07:32:15 +08:00
CODE_OF_CONDUCT.md Adopt the Microsoft Open Source Code of Conduct (#921) 2020-07-22 10:56:05 -07:00
CONTRIBUTING.md Turn `status` into a property of `Action` 2020-10-27 14:00:12 +08:00
LICENSE.md update license 2021-02-03 08:43:51 +08:00
Makefile Add `test` to `make all` 2020-10-27 14:00:12 +08:00
README.md update license 2021-02-03 08:43:51 +08:00
poetry.lock set timeout to spawn process 2021-01-28 17:21:27 +08:00
pyproject.toml set timeout to spawn process 2021-01-28 17:21:27 +08:00

README.md

Linux Integration Services Automation 3.0 (LISAv3)

CI Workflow for LISAv3 Code style: black GitHub license

LISA is a Linux test automation framework with built-in test cases to verify the quality of Linux distributions on multiple platforms (such as Azure, On-prem HyperV, and Linux bare metal).

This version (v3) is a brand new implementation in Python 3, supports running on Windows and Linux distros.

Getting Started

Install Python 3

Install Python 3.8 from Linux distributions package repositories, or python.org. We also need gcc and the libpython headers for the usjon package.

On Ubuntu 18.04 and 20.04:

sudo apt install git python3.8 libpython3.8-dev python3-distutils python3-apt gcc

NOTE: If you are using WSL, installing Poetry on both Windows and Linux may cause both platforms versions of Poetry to be on your path, as Windows binaries are mapped into WSLs PATH. This means that the Linux poetry binary must appear in your PATH before the Windows version, or this error will appear:

/usr/bin/env: python\r: No such file or directory

Install Poetry

On Linux (or WSL):

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python3 - --preview --version 1.1.4
source $HOME/.poetry/env

On Windows (in PowerShell):

(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python - --preview --version 1.1.4
# the path can be added to system, so it applies to every terminal.
$env:PATH += ";$env:USERPROFILE\.poetry\bin"

If you already have Poetry installed, you can update it like:

poetry self update 1.1.4

Install Python packages

Then use Poetry to install LISAv3's Python package dependencies:

git clone -b main https://github.com/LIS/LISAv2.git
cd LISAv2
poetry install

To obtain the path of the Poetry virtual environment setup for LISA (where the isolated Python installation and packages are located), run:

poetry env list --full-path

Run LISAv3

Run LISAv3 using Poetrys environment:

poetry run python lisa/main.py

Make

We now also have a GNU Makefile that automates some tasks. Try:

# Install Python packages
make setup

# Run LISAv3
make run

# Run unit tests
make test

# Run syntactic, semantic, formatting and type checkers
make check

# Generate coverage report (slow, reruns LISAv3 and tests)
make coverage

# Print current Python virtualenv
make venv

Editor Setup

Install and enable ShellCheck to find bash errors locally.

Visual Studio Code

First, click the Python version in the bottom left, then enter the path emitted by the command above. This will point Code to the Poetry virtual environment.

Make sure below settings are in root level of .vscode/settings.json

{
    "python.analysis.typeCheckingMode": "strict",
    "python.formatting.provider": "black",
    "python.linting.enabled": true,
    "python.linting.flake8Enabled": true,
    "python.linting.mypyEnabled": true,
    "python.linting.pylintEnabled": false,
    "editor.formatOnSave": true,
    "python.linting.mypyArgs": [
        "--strict",
        "--namespace-packages",
        "--show-column-numbers",
    ],
    "python.sortImports.path": "isort",
    "python.analysis.useLibraryCodeForTypes": false,
    "python.analysis.autoImportCompletions": false,
    "files.eol": "\n",
}

Emacs

Use the pyvenv package:

(use-package pyvenv
  :ensure t
  :hook (python-mode . pyvenv-tracking-mode))

Then run M-x add-dir-local-variable RET python-mode RET pyvenv-activate RET <path/to/virtualenv> where the value is the path given by the command above. This will create a .dir-locals.el file which looks like this:

;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")

((python-mode . ((pyvenv-activate . "~/.cache/pypoetry/virtualenvs/lisa-s7Q404Ij-py3.8"))))

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.