Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tavern 2.0.0a4 Failures #734

Closed
KenStorey opened this issue Nov 11, 2021 · 5 comments
Closed

Tavern 2.0.0a4 Failures #734

KenStorey opened this issue Nov 11, 2021 · 5 comments

Comments

@KenStorey
Copy link

3.9.8, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 -- /usr/local/bin/python
cachedir: .pytest_cache
metadata: {'Python': '3.9.8', 'Platform': 'Linux-4.19.128-microsoft-standard-x86_64-with', 'Packages': {'pytest': '6.2.5', 'py': '1.11.0', 
'pluggy': '1.0.0'}, 'Plugins': {'metadata': '1.11.0', 'html': '3.1.1', 'tavern': '2.0.0a4'}}
rootdir: /tavern_tests
plugins: metadata-1.11.0, html-3.1.1, tavern-2.0.0a4

In an attempt to circumvent the problem I was having, as reported in #733, I thought I'd give 2.0 a try.

Unfortunately, it didn't get that far, failing at the initial stage:

/tavern_tests/test_tdcp_display_priorities.tavern.yaml::Connect apps to HMI for subsequent tests _____________________Format variables:
  hmi_app_connect_topic = '???'
  high_pri_app = '???'
  hmi_app_connect_response_topic = '???'
  high_pri_app = '???'
  hmi_app_connect_topic = '???'
  low_pri_app = '???'
  hmi_app_connect_response_topic = '???'
  low_pri_app = '???'

Source test stages:
  - name: Step 1 - Connect high priority app
`
    mqtt_publish:
      topic: "{hmi_app_connect_topic}"
      json:
        application: "{high_pri_app}"
        application_ref: 1000

    mqtt_response:
      topic: "{hmi_app_connect_response_topic}"
      json:
        application: "{high_pri_app}"
        application_ref: 1000
        result_code: 0
      timeout: 1

  - name: Step 2 - Connect low priority app

    mqtt_publish:
      topic: "{hmi_app_connect_topic}"
      json:
        application: "{low_pri_app}"
        application_ref: 1001

    mqtt_response:
      topic: "{hmi_app_connect_response_topic}"
      json:
        application: "{low_pri_app}"
        application_ref: 1001
        result_code: 0
      timeout: 1


Stage not found

Errors:
E   tavern._core.exceptions.PluginLoadError: Error loading plugin EntryPoint(name='requests', value='tavern._plugins.rest.tavernhook:TavernRestPlugin', group='tavern_http') - cannot import name 'indent_err_text' from 'tavern.response' (/usr/local/lib/python3.9/site-packages/tavern/response/__init__.py)
------------------------------------------------------------ Captured log call ------------------------------------------------------------ERROR    tavern._core.plugins:plugins.py:24 f
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/stevedore/extension.py", line 221, in _load_plugins
    ext = self._load_one_plugin(ep,
  File "/usr/local/lib/python3.9/site-packages/stevedore/enabled.py", line 77, in _load_one_plugin
    ext = super(EnabledExtensionManager, self)._load_one_plugin(
  File "/usr/local/lib/python3.9/site-packages/stevedore/extension.py", line 255, in _load_one_plugin
    plugin = ep.load()
  File "/usr/local/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "/usr/local/lib/python3.9/site-packages/_pytest/assertion/rewrite.py", line 170, in exec_module
    exec(co, module.__dict__)
  File "/usr/local/lib/python3.9/site-packages/tavern/_plugins/rest/tavernhook.py", line 10, in <module>
    from .response import RestResponse
  File "/usr/local/lib/python3.9/site-packages/_pytest/assertion/rewrite.py", line 170, in exec_module
    exec(co, module.__dict__)
  File "/usr/local/lib/python3.9/site-packages/tavern/_plugins/rest/response.py", line 11, in <module>
    from tavern.response import BaseResponse, indent_err_text
ImportError: cannot import name 'indent_err_text' from 'tavern.response' (/usr/local/lib/python3.9/site-packages/tavern/response/__init__.py)
@michaelboulton
Copy link
Member

Is this in a fresh installation in a docker container or something like that? It looks like an issue with caching of an older version. If it's not a fresh installation, can you try completely removing the old version of Tavern and reinstalling 2.0 and try again?

@KenStorey
Copy link
Author

Yes, it is a fresh install in a docker container. The dockerfile is

FROM python:3.9.8-alpine3.14

# Allows the builder to pass in proxy values for apt.
# This allows kaniko CI containers to access the internet.
ARG PROXY=""
RUN if [ "${PROXY}" != "" ]; then export http_proxy="$PROXY" https_proxy="$PROXY"; fi && \
    apk update && apk upgrade && \
    apk add bash bash-completion git openssh &&\
    pip3 install tavern==2.0.0a4 pytest-html

CMD ["py.test", "./tavern_tests", "-v", "--html=test_report.html", "--self-contained-html"]

In the development environment it's run as part of a docker-compose inside VSCode. The CMD is overridden by a call to bash, and testing is invoked as 'docker exec -t tavern ./tavern_tests/run_tavern_tests.sh ${input:DCP}'

@KenStorey
Copy link
Author

2.0.0a1 & 2.0.0.a2 work, 2.0.0a3 & 2.0.0.a4 do not.

@michaelboulton
Copy link
Member

I think this is an error on my machine from my leaving old pycache files lying about. Can you try with 2.0.0a7?

@KenStorey
Copy link
Author

2.0.0a7 does not exhibit this error, but behaves as I reported in #740.

I will look at that later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants