1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-15 08:36:13 +01:00
github.com_openSUSE_osc/behave
Daniel Mach 4255711344 Implement 'exclude_files' and 'include_files' config options that allow skipping files in the 'checkout' command
Examples:
    osc checkout --setopt='include_files=*.spec *.changes'
    osc checkout --setopt='exclude_files=*.tar.* *.obscpio'
2023-08-30 11:28:30 +02:00
..
features Implement 'exclude_files' and 'include_files' config options that allow skipping files in the 'checkout' command 2023-08-30 11:28:30 +02:00
fixtures Correctly handle passwords with utf-8 characters 2023-06-01 14:00:03 +02:00
container-build.sh behave: Propagate exit codes in the shell scripts properly 2023-06-19 09:27:24 +02:00
container-oscrc Move behave tests from Kanku to Podman, run them in GitHub actions 2022-12-07 15:05:15 +01:00
container-run.sh behave: Propagate exit codes in the shell scripts properly 2023-06-19 09:27:24 +02:00
container-setup-common.sh Move behave tests from Kanku to Podman, run them in GitHub actions 2022-12-07 15:05:15 +01:00
container-setup-initial-data.sh behave: Rename test projects, consistently use the 'test:' prefix 2022-12-08 09:53:01 +01:00
container-setup-prebuilt-rpms.sh build: New option 'disable_hdrmd5_check' to ignore hdrmd5 mismatches 2023-02-21 14:53:08 +01:00
container-setup.sh behave: Fix building the OBS container 2023-06-19 11:49:35 +02:00
container-shell.sh behave: Propagate exit codes in the shell scripts properly 2023-06-19 09:27:24 +02:00
Containerfile behave: Switch the container image to leap:15.5 2023-06-19 09:32:56 +02:00
README.md behave: Switch the container image to leap:15.5 2023-06-19 09:32:56 +02:00

Install requirements

On openSUSE:

$ zypper install osc podman python3-behave

On Fedora:

$ dnf install osc podman python3-behave

Build a container with OBS

$ cd behave

# optional: refresh the base image
$ podman pull opensuse/leap:15.5

# build the container image
$ ./container-build.sh [--no-cache]

We can also use the built container outside the test suite

$ cd behave

# run 'obs-server' container on port 1443
$ ./container-run.sh

# shell into the started container
$ ./container-shell.sh

# stop the started container
$ podman stop|kill obs-server

# remove container image
$ podman rmi obs-server

Run tests

Run all tests

$ cd behave
$ behave -Dosc=../osc-wrapper.py

Run selected tests

$ cd behave
$ behave -Dosc=../osc-wrapper.py features/<file>.feature

Run tests being worked on (decorated with @wip)

$ cd behave
behave -Dosc=../osc-wrapper.py --wip -k

Filesystem layout

<project topdir>
+- behave
     +- features
        +- *.feature       # tests (that use steps defined in the `steps` directory)
                           #   * https://behave.readthedocs.io/en/stable/tutorial.html#feature-files
        +- environment.py  # code that runs before/after certain events (steps, features, etc.)
                           #   * https://behave.readthedocs.io/en/stable/tutorial.html#environmental-controls
                           #   * frequently used to modify ``context``
        +- steps           # step definitions, support code
                           #   * https://behave.readthedocs.io/en/stable/tutorial.html#python-step-implementations
     +- fixtures           # test data
     +- *                  # additional support files

Good to know

  • context provides state information to the tests; you can think of it as passing self to python methods.
  • context.config.userdata contains values of defines specified on the command-line: -D NAME=VALUE -> context.config.userdata[NAME] = VALUE