您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

test_repoman.py 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import pytest
  2. from dds_ci.dds import DDSWrapper
  3. from dds_ci.testing.fixtures import Project
  4. from dds_ci.testing.http import RepoServer
  5. from dds_ci.testing.error import expect_error_marker
  6. from pathlib import Path
  7. @pytest.fixture()
  8. def tmp_repo(tmp_path: Path, dds: DDSWrapper) -> Path:
  9. dds.run(['repoman', 'init', tmp_path])
  10. return tmp_path
  11. def test_add_simple(dds: DDSWrapper, tmp_repo: Path) -> None:
  12. dds.run(['repoman', 'add', tmp_repo, 'git+https://github.com/vector-of-bool/neo-fun.git#0.6.0'])
  13. with expect_error_marker('dup-pkg-add'):
  14. dds.run(['repoman', 'add', tmp_repo, 'git+https://github.com/vector-of-bool/neo-fun.git#0.6.0'])
  15. def test_add_github(dds: DDSWrapper, tmp_repo: Path) -> None:
  16. dds.run(['repoman', 'add', tmp_repo, 'github:vector-of-bool/neo-fun/0.6.0'])
  17. with expect_error_marker('dup-pkg-add'):
  18. dds.run(['repoman', 'add', tmp_repo, 'github:vector-of-bool/neo-fun/0.6.0'])
  19. def test_add_invalid(dds: DDSWrapper, tmp_repo: Path) -> None:
  20. with expect_error_marker('repoman-add-invalid-pkg-url'):
  21. dds.run(['repoman', 'add', tmp_repo, 'invalid://google.com/lolwut'])
  22. def test_error_double_remove(tmp_repo: Path, dds: DDSWrapper) -> None:
  23. dds.run([
  24. 'repoman', '-ltrace', 'add', tmp_repo,
  25. 'https://github.com/vector-of-bool/neo-fun/archive/0.4.0.tar.gz?__dds_strpcmp=1'
  26. ])
  27. dds.run(['repoman', 'remove', tmp_repo, 'neo-fun@0.4.0'])
  28. with expect_error_marker('repoman-rm-no-such-package'):
  29. dds.run(['repoman', 'remove', tmp_repo, 'neo-fun@0.4.0'])
  30. def test_pkg_http(http_repo: RepoServer, tmp_project: Project) -> None:
  31. tmp_project.dds.run([
  32. 'repoman', '-ltrace', 'add', http_repo.server.root,
  33. 'https://github.com/vector-of-bool/neo-fun/archive/0.4.0.tar.gz?__dds_strpcmp=1'
  34. ])
  35. tmp_project.dds.repo_add(http_repo.url)
  36. tmp_project.package_json = {
  37. 'name': 'test',
  38. 'version': '1.2.3',
  39. 'depends': ['neo-fun@0.4.0'],
  40. 'namespace': 'test',
  41. }
  42. tmp_project.build()