gpt4 book ai didi

python - travic ci 错误 AttributeError : 'module' object has no attribute 'hashpw'

转载 作者:行者123 更新时间:2023-12-01 04:11:01 26 4
gpt4 key购买 nike

我正在使用 travis ci 和单元测试。测试在本地工作,但在 travis ci 中不知何故失败这是日志的一部分。

======================================================================

ERROR: test_environment_is_development (test_config.TestConfigurations)

----------------------------------------------------------------------

Traceback (most recent call last):

File "/home/travis/build/afaki077/minitweet/tests/base.py", line 17, in setUp

self.create_user("admin", "ad@min.com", "adminpassword", confirmed=True)

File "/home/travis/build/afaki077/minitweet/tests/base.py", line 33, in create_user

u = User(name, email, password, bio, website, confirmed)

File "<string>", line 4, in __init__

File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/sqlalchemy/orm/state.py", line 306, in _initialize_instance

manager.dispatch.init_failure(self, args, kwargs)

File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__

compat.reraise(exc_type, exc_value, exc_tb)

File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/sqlalchemy/util/compat.py", line 183, in reraise

raise value

File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/sqlalchemy/orm/state.py", line 303, in _initialize_instance

return manager.original_init(*mixed[1:], **kwargs)

File "/home/travis/build/afaki077/minitweet/minitweet_app/models.py", line 55, in __init__

self.password = bcrypt.generate_password_hash(password)

File "/home/travis/virtualenv/python3.4.2/lib/python3.4/site-packages/flask_bcrypt.py", line 163, in generate_password_hash

return bcrypt.hashpw(password, bcrypt.gensalt(rounds))

AttributeError: 'module' object has no attribute 'hashpw'

特拉维斯也一直告诉我我的测试已经通过,尽管事实并非如此

更新

我在本地做了一些测试,我用 pip 删除了 py-bcrypt 模块并运行测试,我在 travis 上遇到了同样的错误,当我重新安装它时一切正常。(它在 travis ci 上仍然损坏)

最佳答案

我解决了我的问题,问题是 travis ci 使用的是过时版本的 pip解决方案只需将其添加到 .travis.yml

install: "pip install --upgrade pip && pip install -r requirements.txt"

关于python - travic ci 错误 AttributeError : 'module' object has no attribute 'hashpw' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34954616/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com