Browse Source

Get tests going again

* Import "topics" from neutron_lib
* Import Neutron via requirements.txt

"topics" has been moved to neutron-lib recently [1]. Need to
import it from there.

The way of importing Neutron into a project has changed. Now as it is
released on pypi, we can use it from there. The old apporach,
specifying the requirement via a git url did not work anymore, since
pip install tried to apply the constraint of [2] on it.

[1] ef93f7e7f0
[2] https://review.openstack.org/#/c/550475/

Change-Id: I62044f0878d1ebf12b73aacbd18996159878f797
Andreas Scheuring 1 year ago
parent
commit
2e59a8d34e

+ 1
- 1
networking_dpm/ml2/dpm_neutron_agent.py View File

@@ -18,6 +18,7 @@ import re
18 18
 from requests.packages import urllib3
19 19
 import sys
20 20
 
21
+from neutron_lib.agent import topics
21 22
 from oslo_log import log as logging
22 23
 import oslo_messaging
23 24
 from oslo_service import service
@@ -29,7 +30,6 @@ from networking_dpm.ml2.mech_dpm import AGENT_TYPE_DPM
29 30
 
30 31
 from neutron.api.rpc.handlers import securitygroups_rpc as sg_rpc
31 32
 from neutron.common import config as common_config
32
-from neutron.common import topics
33 33
 from neutron.plugins.ml2.drivers.agent import _agent_manager_base as amb
34 34
 from neutron.plugins.ml2.drivers.agent import _common_agent as ca
35 35
 

+ 1
- 2
networking_dpm/tests/unit/ml2/test_dpm_neutron_agent.py View File

@@ -17,6 +17,7 @@
17 17
 import sys
18 18
 
19 19
 import mock
20
+from neutron_lib.agent import topics
20 21
 from zhmcclient import ConnectionError
21 22
 from zhmcclient import HTTPError
22 23
 
@@ -26,8 +27,6 @@ from networking_dpm.ml2.dpm_neutron_agent import (PhysicalNetworkMapping as
26 27
 from networking_dpm.tests import base
27 28
 from networking_dpm.tests.unit import fake_zhmcclient
28 29
 
29
-from neutron.common import topics
30
-
31 30
 OID_A = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
32 31
 OID_B = "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"
33 32
 OID_C = "cccccccc-cccc-cccc-cccc-cccccccccccc"

+ 1
- 0
requirements.txt View File

@@ -3,6 +3,7 @@
3 3
 # process, which may cause wedges in the gate later.
4 4
 
5 5
 pbr!=2.1.0,>=2.0.0 # Apache-2.0
6
+neutron>=12.0.0  # Apache-2.0
6 7
 os-dpm>=1.0.0 # Apache-2.0
7 8
 oslo.config>=4.6.0 # Apache-2.0
8 9
 oslo.log>=3.30.0 # Apache-2.0

+ 0
- 69
tools/tox_install.sh View File

@@ -1,69 +0,0 @@
1
-#!/usr/bin/env bash
2
-
3
-# Many of neutron's repos suffer from the problem of depending on neutron,
4
-# but it not existing on pypi.
5
-
6
-# This wrapper for tox's package installer will use the existing package
7
-# if it exists, else use zuul-cloner if that program exists, else grab it
8
-# from neutron master via a hard-coded URL. That last case should only
9
-# happen with devs running unit tests locally.
10
-
11
-# From the tox.ini config page:
12
-# install_command=ARGV
13
-# default:
14
-# pip install {opts} {packages}
15
-
16
-ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
17
-BRANCH_NAME=master
18
-neutron_installed=$(echo "import neutron" | python 2>/dev/null ; echo $?)
19
-NEUTRON_DIR=$HOME/neutron
20
-
21
-set -e
22
-set -x
23
-
24
-install_cmd="pip install -c$1"
25
-shift
26
-
27
-# The devstack based functional tests have neutron checked out in
28
-# $NEUTRON_DIR on the test systems - with the change to test in it.
29
-# Use this directory if it exists, so that this script installs the
30
-# neutron version to test here.
31
-# Note that the functional tests use sudo to run tox and thus
32
-# variables used for zuul-cloner to check out the correct version are
33
-# lost.
34
-if [ -d "$NEUTRON_DIR" ]; then
35
-    echo "FOUND Neutron code at $NEUTRON_DIR - using"
36
-    $install_cmd -U -e $NEUTRON_DIR
37
-elif [ $neutron_installed -eq 0 ]; then
38
-    echo "ALREADY INSTALLED" > /tmp/tox_install.txt
39
-    location=$(python -c "import neutron; print(neutron.__file__)")
40
-    echo "ALREADY INSTALLED at $location"
41
-
42
-    echo "Neutron already installed; using existing package"
43
-elif [ -x "$ZUUL_CLONER" ]; then
44
-    echo "ZUUL CLONER" > /tmp/tox_install.txt
45
-    # Make this relative to current working directory so that
46
-    # git clean can remove it. We cannot remove the directory directly
47
-    # since it is referenced after $install_cmd -e.
48
-    mkdir -p .tmp
49
-    NEUTRON_DIR=$(/bin/mktemp -d -p $(pwd)/.tmp)
50
-    pushd $NEUTRON_DIR
51
-    $ZUUL_CLONER --cache-dir \
52
-        /opt/git \
53
-        --branch $BRANCH_NAME \
54
-        git://git.openstack.org \
55
-        openstack/neutron
56
-    cd openstack/neutron
57
-    $install_cmd -e .
58
-    popd
59
-else
60
-    echo "PIP HARDCODE" > /tmp/tox_install.txt
61
-    if [ -z "$NEUTRON_PIP_LOCATION" ]; then
62
-        NEUTRON_PIP_LOCATION="git+https://git.openstack.org/openstack/neutron@$BRANCH_NAME#egg=neutron"
63
-    fi
64
-    $install_cmd -U -e ${NEUTRON_PIP_LOCATION}
65
-fi
66
-
67
-$install_cmd -U $*
68
-exit $?
69
-

+ 2
- 1
tox.ini View File

@@ -5,12 +5,13 @@ skipsdist = True
5 5
 
6 6
 [testenv]
7 7
 usedevelop = True
8
-install_command = {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
8
+install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
9 9
 setenv =
10 10
    VIRTUAL_ENV={envdir}
11 11
    PYTHONWARNINGS=default::DeprecationWarning
12 12
 deps = -r{toxinidir}/test-requirements.txt
13 13
        -r{toxinidir}/requirements.txt
14
+
14 15
 whitelist_externals = bash
15 16
 commands = bash tools/pretty_tox.sh '{posargs}'
16 17
 

Loading…
Cancel
Save