簡體   English   中英

Python 行為測試未在 bitBucket CI 上運行

[英]Python Behave tests not running on bitBucket CI

我們有一個簡單的 Python 基於行為的測試套件。 它在本地環境中運行良好。

用於運行測試的命令:

pip3 install -r requirements.txt    
behave -D URL=https://api.ourUrl.org/test/shopping

有一個可選的基於 npm 的 Allure 報告生成步驟,但這不是問題的重點。

來自 Bitbucket 運行的錯誤跟蹤:

Then the shopping service will return HTTP 200 OK status # features/steps/shopping_api.py:34 Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/behave/model.py", line 1329, in run match.run(runner.context) File "/usr/local/lib/python3.7/site-packages/behave/matchers.py", line 98, in run self.func(context, *args, **kwargs) File "features/steps/shipping_api.py", line 78, in step_impl assert context.response.status_code == int(statusCode) AssertionError

需求.txt:

astroid==2.3.3
attrs==19.3.0
behave==1.2.6
certifi==2019.11.28
chardet==3.0.4
idna==2.8
isort==4.3.21
lazy-object-proxy==1.4.3
lxml==4.4.2
mccabe==0.6.1
parse==1.14.0
parse-type==0.5.2
Pillow==5.4.1
pylint==2.4.4
pypng==0.0.20
requests==2.22.0
six==1.14.0
tinycss2==0.6.1
transitions==0.6.9
typed-ast==1.4.0
ua-parser==0.8.0
urllib3==1.25.7
webencodings==0.5.1
wrapt==1.11.2
xmlrunner==1.7.7
regex==2020.5.7

我已經嘗試從 pip 切換到管道上的 pip3 並且還添加了 regex==2020.5.7 但它沒有任何效果。 請建議如何解決這個問題? 非常感謝

另請注意,我們正在使用“重新”匹配器

在此處輸入圖像描述

它在本地環境中運行良好。

預期 200 並獲得狀態碼 -> 403

是的。 所有的測試都失敗了。 但是,如果我從 bitbucket yaml 文件直接到端點然后它返回成功

所以,據我說:

  1. 不可能有邏輯錯誤,因為它在本地主機上工作
  2. 不可能有連接錯誤,因為它在 bitbucket yaml 文件中的 curl 上工作得很好

如果您所說和所做的一切都是正確的,那么唯一可能的答案是您可能沒有將 Bitbucket 的 IP 地址列入白名單以允許端點

或者,如果您說的所有或某些事情可能是錯誤的,那么您可能在 Bitbucket CI 工作的操作系統上出現某種邏輯錯誤或某些支持錯誤(例如嘗試在虛擬機中進行測試)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM