nosetest在项目中找不到测试

问题描述 投票:0回答:1

我在鼻子测试方面遇到问题。我在python2中使用了很多东西,这是python3的第一次。

显然,除非我未指定文件,否则它不会在项目中找到测试。

lpuggini@lpuggini-T3420:~/Connectors/trunk/modules/src/adam/src/adam/adam$ nosetests -v

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
lpuggini@lpuggini-T3420:~/Connectors/trunk/modules/src/adam/src/adam/adam$ nosetests -v testing_tools/tests/test_testing_tools.py 
test_testing_tools.test_root_paths ... ok

----------------------------------------------------------------------
Ran 1 test in 0.000s

OK
lpuggini@lpuggini-T3420:~/Connectors/trunk/modules/src/adam/src/adam/adam$ 

这是项目结构:

(adam_venv) lpuggini@lpuggini-T3420:~/Connectors/trunk/modules/src/adam/src/adam$ tree 
.
├── adam
│   ├── baseline
│   │   ├── action
│   │   │   ├── anomaly_score.py
│   │   │   ├── __init__.py
│   │   │   ├── __pycache__
│   │   │   │   └── __init__.cpython-38.pyc
│   │   │   ├── query_manager.py
│   │   │   ├── runner.py
│   │   │   └── tests
│   │   ├── database_manager.py
│   │   ├── __init__.py
│   │   ├── input_manager.py
│   │   ├── __pycache__
│   │   │   └── __init__.cpython-38.pyc
│   │   ├── query_manager.py
│   │   ├── runner.py
│   │   ├── status_file_manager.py
│   │   ├── tests
│   │   │   ├── __init__.py
│   │   │   └── __pycache__
│   │   │       └── __init__.cpython-38.pyc
│   │   ├── time_smoothed_baseliner.py
│   │   └── weighted_exp_baseline.py
│   ├── common
│   │   ├── __init__.py
│   │   ├── __pycache__
│   │   │   └── __init__.cpython-38.pyc
│   │   └── utils
│   │       ├── cne_config.py
│   │       ├── cnx.py
│   │       ├── cnx_util.py
│   │       ├── config_executor.py
│   │       ├── console_spinner.py
│   │       ├── curl_utils.py
│   │       ├── file_lock.py
│   │       ├── files.py
│   │       ├── general_util.py
│   │       ├── __init__.py
│   │       ├── log_utils.py
│   │       ├── memory_utils.py
│   │       ├── popen_util.py
│   │       ├── __pycache__
│   │       │   └── __init__.cpython-38.pyc
│   │       ├── remote_debugger.py
│   │       ├── rest_api.py
│   │       ├── shell_command.py
│   │       └── wait_utils.py
│   ├── config
│   │   ├── config_manager.py
│   │   ├── config_validator.py
│   │   ├── __init__.py
│   │   ├── __pycache__
│   │   │   └── __init__.cpython-38.pyc
│   │   └── statistics_mapping.py
│   ├── __init__.py
│   ├── module_setup
│   │   ├── alerts.py
│   │   ├── constants.py
│   │   ├── daemon.py
│   │   ├── __init__.py
│   │   ├── logger.py
│   │   ├── messages.py
│   │   ├── paths_manager.py
│   │   ├── __pycache__
│   │   │   ├── __init__.cpython-38.pyc
│   │   │   └── paths_manager.cpython-38.pyc
│   │   ├── setup.py
│   │   ├── sshcmd.py
│   │   ├── status_manager.py
│   │   ├── status.py
│   │   ├── status_util.py
│   │   └── tasks_manager.py
│   ├── __pycache__
│   │   └── __init__.cpython-38.pyc
│   └── testing_tools
│       ├── __init__.py
│       ├── __pycache__
│       │   ├── __init__.cpython-38.pyc
│       │   └── testing_tools.cpython-38.pyc
│       ├── testing_tools.py
│       └── tests
│           ├── __pycache__
│           │   └── test_testing_tools.cpython-38.pyc
│           └── test_testing_tools.py
├── Distribution.egg-info
│   ├── dependency_links.txt
│   ├── PKG-INFO
│   ├── SOURCES.txt
│   └── top_level.txt
└── setup.py

22 directories, 69 files
(adam_venv) lpuggini@lpuggini-T3420:~/Connectors/trunk/modules/src/adam/src/adam$ 

我不明白为什么它没有找到测试。python2和3之间在用法上有什么区别吗?

python-3.x nose
1个回答
0
投票

我意识到由于权限问题,鼻子测试无法找到测试。

我的结论是:

  1. 所有文件夹应标记为可执行文件
  2. 所有测试文件都不应该是可执行的。

我固定为:

sudo chmod -r +X . && sudo chmod -r -x .
© www.soinside.com 2019 - 2024. All rights reserved.