天天看點

Centos7 裝python3 + pytest + allure 遇到的問題【python3部分】【pytest部分】 【allure部分】

【python3部分】

Centos7 伺服器預設安裝有python2.7,後面運維幫再裝了個python3.6,【如果沒裝,可以參照這個方法教程:https://blog.csdn.net/weixin_46043193/article/details/112993595】

【pytest部分】

在對pytest進行軟連結設定時【參照教程:https://blog.csdn.net/weixin_46043193/article/details/112998885】,由于手快完全照着教程敲,導到目标目錄弄錯【本地實際位址是:/usr/local/python/bin/pytest,敲成: /usr/local/python3/bin/pytest,如下圖(紅色且閃爍)】,最終導緻運作pytest時,提示指令找不到:但是用python3 -m pytest能通路

Centos7 裝python3 + pytest + allure 遇到的問題【python3部分】【pytest部分】 【allure部分】

 解決過程:

1、嘗試過用rm  -rf 【軟連結位址】   删除,但是不成功,切換到軟連結位址還能看到pytest存在;

2、後面試着用 ln -sf 【新目标目錄】 【軟連結位址】修改軟連結,再運作pytest,成功了!

【軟連結設定教程:https://blog.csdn.net/xhx94/article/details/98865598】

Centos7 裝python3 + pytest + allure 遇到的問題【python3部分】【pytest部分】 【allure部分】

 再 ll 檢視 /usr/bin 目錄,發現pytest指向的路徑不再是紅色。

Centos7 裝python3 + pytest + allure 遇到的問題【python3部分】【pytest部分】 【allure部分】

 再輸入pytest --version 能正常檢視版本号

Centos7 裝python3 + pytest + allure 遇到的問題【python3部分】【pytest部分】 【allure部分】

 【allure部分】

開始的時候是參照這個教程中allure部分進行設定,【https://blog.csdn.net/baozi_xiaoge/article/details/103418891】,但是後用sudo su 切換到root使用者後,運作allure --version 會提示找不到指令;需要重新加載一下配置檔案source /etc/profile,allure --version 指令才可以正常運作!

解決過程:

1、根據pytest的經驗,設定一個軟連結 ln -s /usr/local/allure-2.13.8/bin/allure  /usr/bin/allure

現在用什麼帳戶都可以正常執行 allure 指令了!

【allure教程可參照:https://blog.csdn.net/u012799877/article/details/105398081】