Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A AutoIntent
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 10
    • Issues 10
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • DeepPavlov
  • AutoIntent
  • Issues
  • #19
Closed
Open
Issue created Oct 17, 2024 by Roman Zlobin@RLKRoMaintainer

Refactor `tests` module

Created by: voorhs

https://github.com/deeppavlov/AutoIntent/blob/77a0d2499c02e21841e02a5d23b266a3b7003c5e/tests/minimal_optimization/test_minimal_optimization.py#L16

Мне кажется, стоит использовать importlib.resources вместо таких конструкций. И надо в целом зарефакторить модуль с тестами:

  • сделать отдельную папку для логов, чтобы прописать её в .gitignore
  • дать файлам другие имена, чтобы отразить, что данный тест относится к узлу / модулю / пайплайну, к оптимизации / инференсу, к python API / CLI

Тогда обращение к файловой системе, чтобы достать конфиги или сохранить логи, упростится и унифицируется:

import importlib.resources as ires

# write to file
logs_dir = pathlib.Path.cwd() / "test_logs"
with logs_dir.open("w") as file:
    json.dump(logs, file, indent=4)
    
# read file
with ires.files("autointent.datafiles").joinpath(config_name).open() as file:
    file_content = file.read()

# resolve path
path = ires.files("tests.configs").joinpath("multilabel.yaml"):
config_path = path  # pathlib.Path object

.gitignore

test_logs

К тому же надо добавить тесты на GPU (сейчас все тесты на CPU)

Assignee
Assign to
Time tracking