- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我已成功将 ssh-key
放入 docker runner,它可以 git clone
进行依赖项安装。
如果我使用普通的内置python manage.py test
它工作正常。但我现在正在使用 pytest。我可以在 ly 命令行上运行 pytest 并得到正常结果。
$ pytest
===================================================================================== test session starts =====================================================================================
platform darwin -- Python 3.6.4, pytest-3.2.5, py-1.5.2, pluggy-0.4.0
Django settings: poinkbackend.config.settings.local (from ini file)
rootdir: /Users/sarit/Code/poink, inifile: pytest.ini
plugins: django-3.1.2
collected 66 items
poinkbackend/apps/activities/tests.py ..
poinkbackend/apps/amendments/tests.py ........
poinkbackend/apps/branches/tests.py ....
poinkbackend/apps/company_perms/tests.py ......
poinkbackend/apps/news/tests.py ......
poinkbackend/apps/orders/tests.py .....
poinkbackend/apps/poinks/tests.py .
poinkbackend/apps/redemptions/tests.py ..s....
poinkbackend/apps/rewards/tests.py ..
poinkbackend/apps/roles/tests.py ........
poinkbackend/apps/userprofiles/tests.py ............ss...
但是当我在 gitlab-ci
中执行时。我使用 docker
作为 runner
。
更新1:
我确定。我在顶层目录中有 pytest.ini 。pytest.ini
:
[pytest]
DJANGO_SETTINGS_MODULE = poinkbackend.config.settings.local
python_files = tests.py test_*.py *_tests.py
Successfully built django-dirtyfields django-reversion django-s3-folder-storage olefile simplegeneric
Installing collected packages: django-geoposition, pytz, django, py-moneyed, django-money, appnope, jmespath, six, python-dateutil, docutils, botocore, s3transfer, boto3, certifi, chardet, django-storages, collectfast, decorator, django-choices, django-cors-headers, django-countries, sqlparse, django-debug-toolbar, django-dirtyfields, django-environ, typing, django-extensions, django-filter, django-guardian, django-reversion, django-s3-folder-storage, pyjwt, djangorestframework-jwt, djangorestframework, freezegun, greenlet, gevent, gunicorn, idna, ipython-genutils, pygments, simplegeneric, pickleshare, ptyprocess, pexpect, traitlets, wcwidth, prompt-toolkit, parso, jedi, ipython, model-mommy, olefile, pillow, psycopg2, py, pytest, pytest-django, urllib3, requests, rest-framework-generic-relations, werkzeug
Running setup.py develop for django-geoposition
Running setup.py develop for django-money
Successfully installed appnope-0.1.0 boto3-1.4.7 botocore-1.7.47 certifi-2017.11.5 chardet-3.0.4 collectfast-0.5.2 decorator-4.1.2 django-1.11.7 django-choices-1.6.0 django-cors-headers-2.1.0 django-countries-5.0 django-debug-toolbar-1.9.1 django-dirtyfields-1.3 django-environ-0.4.4 django-extensions-1.9.7 django-filter-1.1.0 django-geoposition django-guardian-1.4.9 django-money django-reversion-2.0.10 django-s3-folder-storage-0.5 django-storages-1.6.5 djangorestframework-3.7.3 djangorestframework-jwt-1.11.0 docutils-0.14 freezegun-0.3.9 gevent-1.2.2 greenlet-0.4.12 gunicorn-19.7.1 idna-2.6 ipython-6.2.1 ipython-genutils-0.2.0 jedi-0.11.0 jmespath-0.9.3 model-mommy-1.4.0 olefile-0.44 parso-0.1.0 pexpect-4.3.0 pickleshare-0.7.4 pillow-4.3.0 prompt-toolkit-1.0.15 psycopg2-2.7.3.2 ptyprocess-0.5.2 py-1.5.2 py-moneyed-0.7.0 pygments-2.2.0 pyjwt-1.5.3 pytest-3.2.5 pytest-django-3.1.2 python-dateutil-2.6.1 pytz-2017.3 requests-2.18.4 rest-framework-generic-relations-1.1.0 s3transfer-0.1.11 simplegeneric-0.8.1 six-1.11.0 sqlparse-0.2.4 traitlets-4.3.2 typing-3.6.2 urllib3-1.22 wcwidth-0.1.7 werkzeug-0.12.2
$ pwd
/builds/sarit/poink
$ ls
DockerFileBackend
README.md
delete_migrations.sh
docker-compose.yml
f2
frontend
manage.py
poinkbackend
pytest.ini
renew_db.sh
requirements.in
requirements.txt
src
static
static_files
test_gitlab.sh
$ pytest
============================= test session starts ==============================
platform linux -- Python 3.6.4, pytest-3.2.5, py-1.5.2, pluggy-0.4.0
Django settings: poinkbackend.config.settings.local (from ini file)
rootdir: /builds/sarit/poink, inifile: pytest.ini
plugins: django-3.1.2
collected 0 items / 1 errors
==================================== ERRORS ====================================
______________________________ ERROR collecting _______________________________
/usr/local/lib/python3.6/site-packages/_pytest/config.py:342: in _getconftestmodules
return self._path2confmods[path]
E KeyError: local('/builds/sarit/poink/src/django-money/tests')
During handling of the above exception, another exception occurred:
/usr/local/lib/python3.6/site-packages/_pytest/config.py:373: in _importconftest
return self._conftestpath2mod[conftestpath]
E KeyError: local('/builds/sarit/poink/src/django-money/tests/conftest.py')
During handling of the above exception, another exception occurred:
/usr/local/lib/python3.6/site-packages/_pytest/config.py:379: in _importconftest
mod = conftestpath.pyimport()
/usr/local/lib/python3.6/site-packages/py/_path/local.py:668: in pyimport
__import__(modname)
<frozen importlib._bootstrap>:971: in _find_and_load
???
<frozen importlib._bootstrap>:955: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:656: in _load_unlocked
???
<frozen importlib._bootstrap>:626: in _load_backward_compatible
???
/usr/local/lib/python3.6/site-packages/_pytest/assertion/rewrite.py:212: in load_module
py.builtin.exec_(co, mod.__dict__)
src/django-money/tests/conftest.py:9: in <module>
from tests.testapp.models import InheritorModel, ModelWithDefaultAsInt
src/django-money/tests/testapp/models.py:21: in <module>
class ModelWithVanillaMoneyField(models.Model):
/usr/local/lib/python3.6/site-packages/django/db/models/base.py:118: in __new__
"INSTALLED_APPS." % (module, name)
E RuntimeError: Model class tests.testapp.models.ModelWithVanillaMoneyField doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
During handling of the above exception, another exception occurred:
/usr/local/lib/python3.6/site-packages/py/_path/common.py:377: in visit
for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
/usr/local/lib/python3.6/site-packages/py/_path/common.py:429: in gen
for p in self.gen(subdir):
/usr/local/lib/python3.6/site-packages/py/_path/common.py:429: in gen
for p in self.gen(subdir):
/usr/local/lib/python3.6/site-packages/py/_path/common.py:418: in gen
dirs = self.optsort([p for p in entries
/usr/local/lib/python3.6/site-packages/py/_path/common.py:419: in <listcomp>
if p.check(dir=1) and (rec is None or rec(p))])
/usr/local/lib/python3.6/site-packages/_pytest/main.py:737: in _recurse
ihook = self.gethookproxy(path)
/usr/local/lib/python3.6/site-packages/_pytest/main.py:641: in gethookproxy
my_conftestmodules = pm._getconftestmodules(fspath)
/usr/local/lib/python3.6/site-packages/_pytest/config.py:356: in _getconftestmodules
mod = self._importconftest(conftestpath)
/usr/local/lib/python3.6/site-packages/_pytest/config.py:381: in _importconftest
raise ConftestImportFailure(conftestpath, sys.exc_info())
E _pytest.config.ConftestImportFailure: RuntimeError("Model class tests.testapp.models.ModelWithVanillaMoneyField doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.",)
E File "<frozen importlib._bootstrap>", line 971, in _find_and_load
E File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
E File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
E File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
E File "/usr/local/lib/python3.6/site-packages/_pytest/assertion/rewrite.py", line 212, in load_module
E py.builtin.exec_(co, mod.__dict__)
E File "/builds/sarit/poink/src/django-money/tests/conftest.py", line 9, in <module>
E from tests.testapp.models import InheritorModel, ModelWithDefaultAsInt
E File "/builds/sarit/poink/src/django-money/tests/testapp/models.py", line 21, in <module>
E class ModelWithVanillaMoneyField(models.Model):
E File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 118, in __new__
E "INSTALLED_APPS." % (module, name)
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!
=========================== 1 error in 0.57 seconds ============================
ERROR: Job failed: exit code 1
.gitlab-ci.yml
image: python:3.6
services:
- postgres:latest
variables:
POSTGRES_DB: poinkdb
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan github.com >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- git config --global user.email "sarit@elcolie.com"
- git config --global user.name "sarit"
- python -V
- pip install -r requirements.txt
test:
tags:
- poink
- Elcolie
variables:
DATABASE_URL : "postgres://postgres:postgres@postgres:5432/poinkdb"
script:
- pytest
问题:
更新2:
更新3:
gitlab-ci
通过使用docker runner
运行pytest
?最佳答案
感谢https://github.com/nicoddemus
他在最后一行对我的问题的引用显示了 /src
这不是我的目录。它是在途中创建的。
我的陷阱是 runner
在 /src
中创建 python 依赖项,而不是在其他隐藏目录中
[pytest]
DJANGO_SETTINGS_MODULE = poinkbackend.config.settings.local
python_files = tests.py test_*.py *_tests.py
norecursedirs = src
关于python - Docker runner pytest 不收集测试用例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47966456/
引用网址 http://hi.baidu.com/quiteuniverse/blog/item/9f3f043d46ad1e07bba16716.html 以下函数调用方式:&nbs
我什至不确定如何描述我正在尝试做的事情,因为我对 cookie 了解不多,但就这样吧。 是否可以使用PHP从浏览器缓存中收集一个cookie(或cookie文件),将其保存到数据库中,然后清除缓存并重
我正在使用 Room(v. 2.2.1)和协程支持(v. 1.3.2)并进行以下设置 @Entity(tableName = "simple_table") data class SimpleEnti
我正在尝试编写一个基于时间运算符收集/累积值的规则。 rule "Zone6 Overlap" when $i1 : Instance ($e1 : event == " Vel : 20.9
我有一个简单的 BST,定义了节点结构: struct node { int key_value; struct node *left; struct node *right; }; ty
我有这个对象: public class MenuPriceByDay implements Serializable { private BigDecimal avgPrice; p
我正在开发一个应用程序,需要访问给定传感器的“最后 5 秒有值(value)的数据”。我的计划是以某种方式存储这些数据,然后当我请求数据时,它将返回最近 5 秒内获得的所有数据。鉴于以下情况,我不确定
在 Ruby 中,您可以对数组使用 map/collect 方法来修改它: a = [ "a", "b", "c", "d" ] a.collect! {|x| x + "!" } a
我即将开始实时收集大量数字数据(对于那些感兴趣的人,各种股票和 future 的出价/要价/最后或“磁带”)。稍后将检索数据以进行分析和模拟。这一点都不难,但我想高效地做到这一点,这会带来很多问题。我
我提出这个问题是为了寻求有关如何设计系统的实用建议。 像 amazon.com 和 pandora 这样的网站拥有并维护着庞大的数据集来运行他们的核心业务。例如,亚马逊(以及所有其他主要电子商务网站)
假设我们有一个数据数组和另一个带索引的数组。 data = [1, 2, 3, 4, 5, 7] index = [5, 1, 4, 0, 2, 3] 我们想从 index 的 data 元素创建一个
好的,我已经阅读了几个关于它的主题,但现在就开始吧。假设我有一个应用程序,基本上我会时不时地点击一个按钮,几分钟内会发生很多事情,然后它可能会再闲置一个小时,或者可能只是 1 分钟。难道不是在整个结束
我有一个数据框,例如 Seq Chrm start end length score 0 A C1 1 50 49 12 1 B
我正在考虑在 Object[] 数组中收集泛型方法的所有方法参数以进行记录。我知道使用方面可以更好地实现这一点,但是我不允许使用它,并且如果可能的话我正在寻找一种基于纯反射的方法 为了澄清, 假设一个
快速提问: 如果 Socket 对象(及其本地缓存的 InputStream 和 OutputStream 对象)超出范围并被垃圾收集,连接是否在 JVM 中保持打开状态? (即,不会在监听服务器上抛
是否有用于收集 facebook 公共(public)数据作为实时提要的 API。我阅读了关于用于收集数据的公共(public)提要 API,但我现在不能申请,而且它不是免费的,还有 Open str
摘要 :我使用自定义收集器收集给定搜索的所有命中的文档 ID(它使用 ID 填充 BitSet)。根据我的需要,搜索和获取文档 ID 的速度非常快,但是当涉及到从磁盘实际获取文档时,事情变得非常缓慢。
我正在寻找一种方法来从自定义 Gradle 插件收集给定项目的所有依赖约束(通过常规 platform 和/或 enforcedPlatform 和/或“手动”强制执行)。 在 Maven 世界中,您
我有一个 CSV 格式的用户列表,但我需要按广告中的名称从每个用户收集 SamAccount 属性。 CSV 模型 脚本 Get-ADObject -Filter 'ObjectClass -eq "
我得到了一个非常大的列表,其中包含大约 200 个带有文本和图像的项目。 ng-repeat 是一种缓慢渲染的方式。它尝试过这个 solution 。效果很好。但不适合重复收集。 我的网络服务返回此:
我是一名优秀的程序员,十分优秀!