pytest相关

pytest相关

pytest --ignore=tests/foobar/test_foobar_03.py --ignore=tests/hello/
忽略tests/foobar/test_foobar_03.py 以及 tests/hello/所有测试用例
addopts是联合参数的意思
--ignore-glob 是模糊匹配并忽略匹配到的测试用例,就是.py文件

cocotb 原则上需要.py文件,makefile文件,hdl文件,三个,makefile告诉编译器需要的信息,如hdl里的顶层模块名,python的文件名

  • pyenv versions 查看当前所有python版本

  • pyenv version 查看当前python版本

  • pyenv install --list 查看可安装的版本

  • pyenv install 3.10.18

  • pyenv global system 切换全局默认为系统python

  • pyenv global 3.10.18 切换为全局默认为3.10.18

  • pyenv local 3.10.18 切换当前目录到3.10.18版本

  • pyenv virtualenvs 查看当前所有虚拟环境 There are two entries for each virtualenv, and the shorter one is just a symlink.

  • pyenv virtualenv venv 创建基于当前python的虚拟环境

  • pyenv virtualenv 3.10.18 venv_31018 会在$(pyenv root)/versions目录下创建venv_31018目录,一个基于3.10.18的虚拟环境

  • pyenv activate venv_31018 激活环境

  • pyenv deactivate 关闭环境

  • pyenv uninstall venv_31018 移除环境

  • pyenv virtualenv-delete venv_31018 同上

执行github一键安装脚本:curl -fsSL https://pyenv.run | bash,会自动安装virtualenv插件

安装后,往~/.bashrc ~/.zshrc ~/.profile添加如下:

  • echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc

  • echo '[[ -d \(PYENV_ROOT/bin ]] && export PATH="\)PYENV_ROOT/bin:$PATH"' >> ~/.bashrc

  • echo 'eval "$(pyenv init - bash)"' >> ~/.bashrc

  • echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc

  • echo '[[ -d \(PYENV_ROOT/bin ]] && export PATH="\)PYENV_ROOT/bin:$PATH"' >> ~/.zshrc

  • echo 'eval "$(pyenv init - zsh)"' >> ~/.zshrc

  • echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile

  • echo '[[ -d \(PYENV_ROOT/bin ]] && export PATH="\)PYENV_ROOT/bin:$PATH"' >> ~/.profile

  • echo 'eval "$(pyenv init - bash)"' >> ~/.profile

往 ~/.bashrc ~/.zshrc添加:

  • echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc

  • echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.zshrc

  • exec "$SHELL" 激活PATH

查看包里有哪些模块

import cocotbext.axi
dir(cocotbext.axi)
['AddressSpace', 'AxiARBus', 'AxiAWBus', 'AxiBBus', 'AxiBurstSize', 'AxiBurstType', 'AxiBus', 'AxiCacheBit', 'AxiLiteARBus', 'AxiLiteAWBus', 'AxiLiteBBus', 'AxiLiteBus', 'AxiLiteMaster', 'AxiLiteMasterRead', 'AxiLiteMasterWrite', 'AxiLiteRBus', 'AxiLiteRam', 'AxiLiteRamRead', 'AxiLiteRamWrite', 'AxiLiteReadBus', 'AxiLiteSlave', 'AxiLiteSlaveRead', 'AxiLiteSlaveWrite', 'AxiLiteWBus', 'AxiLiteWriteBus', 'AxiLockType', 'AxiMaster', 'AxiMasterRead', 'AxiMasterWrite', 'AxiProt', 'AxiRBus', 'AxiRam', 'AxiRamRead', 'AxiRamWrite', 'AxiReadBus', 'AxiResp', 'AxiSlave', 'AxiSlaveRead', 'AxiSlaveWrite', 'AxiStreamBus', 'AxiStreamFrame', 'AxiStreamMonitor', 'AxiStreamSink', 'AxiStreamSource', 'AxiWBus', 'AxiWriteBus', 'MemoryInterface', 'MemoryRegion', 'PeripheralRegion', 'Pool', 'Region', 'Window', 'WindowPool', 'builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'path', 'spec', 'version', 'address_space', 'axi_channels', 'axi_master', 'axi_ram', 'axi_slave', 'axil_channels', 'axil_master', 'axil_ram', 'axil_slave', 'axis', 'buddy_allocator', 'constants', 'memory', 'reset', 'stream', 'utils', 'version']

posted @ 2025-12-29 16:15  原声带1993  阅读(0)  评论(0)    收藏  举报