Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c57f0c73 authored by Gaël Duval's avatar Gaël Duval 🏄🏼
Browse files

Merge branch 'nicofonk/tests' into 'master'

Tests infra improvements

See merge request e/cloud/my-spot!22
parents 54760155 35e4c544
Loading
Loading
Loading
Loading

.codecov.yml

deleted100644 → 0
+0 −31
Original line number Diff line number Diff line
comment: false
coverage:
  status:
    project:
      default:
        # basic
        target: auto
        threshold: null
        base: auto 
        # advanced
        branches: null
        if_no_uploads: error
        if_not_found: success
        if_ci_failed: error
        only_pulls: false
        flags: null
        paths: null
    patch:
      default:
        # basic
        target: auto
        threshold: null
        base: auto 
        # advanced
        branches: null
        if_no_uploads: error
        if_not_found: success
        if_ci_failed: error
        only_pulls: false
        flags: null
        paths: null

.coveragerc

deleted100644 → 0
+0 −20
Original line number Diff line number Diff line
[run]
branch = True
source =
  searx/engines
  searx/__init__.py
  searx/autocomplete.py
  searx/https_rewrite.py
  searx/languages.py
  searx/search.py
  searx/testing.py
  searx/utils.py
  searx/webapp.py

[report]
show_missing = True
exclude_lines =
    if __name__ == .__main__.:

[html]
directory = coverage
+1 −0
Original line number Diff line number Diff line
@@ -27,3 +27,4 @@ unittest:
    - ./manage.sh update_dev_packages
  script:
    - ./manage.sh unit_tests
  coverage: '/TOTAL.*\s+(\d+%)$/'
+6 −1
Original line number Diff line number Diff line
FROM fedora

COPY requirements.txt requirements-dev.txt /

RUN dnf install -y\
 wget\
 python2-pip\
 npm\
&& dnf groupinstall -y "Development Tools" \
&& pip3 install pytest ipdb ipython
&& pip3 install ipdb ipython \
&& pip3 install -r /requirements.txt \
&& pip3 install -r /requirements-dev.txt \
&& rm -f /requirements.txt /requirements-dev.txt
+1 −48
Original line number Diff line number Diff line
@@ -26,46 +26,6 @@ update_dev_packages() {
    pip3 install -r "$BASE_DIR/requirements-dev.txt"
}

install_geckodriver() {
    echo '[!] Checking geckodriver'
    # TODO : check the current geckodriver version
    set -e
    geckodriver -V > /dev/null 2>&1 || NOTFOUND=1
    set +e
    if [ -z "$NOTFOUND" ]; then
        return
    fi
    GECKODRIVER_VERSION="v0.19.1"
    PLATFORM="`python3 -c "import platform; print(platform.system().lower(), platform.architecture()[0])"`"
    case "$PLATFORM" in
        "linux 32bit" | "linux2 32bit") ARCH="linux32";;
        "linux 64bit" | "linux2 64bit") ARCH="linux64";;
        "windows 32 bit") ARCH="win32";;
        "windows 64 bit") ARCH="win64";;
        "mac 64bit") ARCH="macos";;
    esac
    GECKODRIVER_URL="https://github.com/mozilla/geckodriver/releases/download/$GECKODRIVER_VERSION/geckodriver-$GECKODRIVER_VERSION-$ARCH.tar.gz";

    if [ -z "$1" ]; then
        if [ -z "$VIRTUAL_ENV" ]; then
            printf "geckodriver can't be installed because VIRTUAL_ENV is not set, you should download it from\n  %s" "$GECKODRIVER_URL"
            exit
        else
            GECKODRIVER_DIR="$VIRTUAL_ENV/bin"
        fi
    else
        GECKODRIVER_DIR="$1"
        mkdir -p -- "$GECKODRIVER_DIR"
    fi

    printf "Installing %s/geckodriver from\n  %s" "$GECKODRIVER_DIR" "$GECKODRIVER_URL"

    FILE="`mktemp`"
    wget -qO "$FILE" -- "$GECKODRIVER_URL" && tar xz -C "$GECKODRIVER_DIR" -f "$FILE" geckodriver
    rm -- "$FILE"
    chmod 777 -- "$GECKODRIVER_DIR/geckodriver"
}

locales() {
    pybabel compile -d "$SEARX_DIR/translations"
}
@@ -80,7 +40,7 @@ pep8_check() {

unit_tests() {
    echo '[!] Running unit tests'
    python3 -m nose2 -s "$BASE_DIR/tests/unit"
    PYTHONPATH="$BASE_DIR" pytest --cov=searx --disable-pytest-warnings "$BASE_DIR/tests/unit"
}

py_test_coverage() {
@@ -90,17 +50,10 @@ py_test_coverage() {
    && coverage html
}

robot_tests() {
    echo '[!] Running robot tests'
    PYTHONPATH="`pwd`" python3 "$SEARX_DIR/testing.py" robot
}

tests() {
    set -e
    pep8_check
    unit_tests
    install_geckodriver
    robot_tests
    set +e
}

Loading