You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 line
2.1KB

  1. import json
  2. import pytest
  3. from dds_ci.testing import RepoServer, Project
  4. SIMPLE_CATALOG = {
  5. "packages": {
  6. "neo-fun": {
  7. "0.3.0": {
  8. "remote": {
  9. "git": {
  10. "url": "https://github.com/vector-of-bool/neo-fun.git",
  11. "ref": "0.3.0"
  12. }
  13. }
  14. }
  15. }
  16. }
  17. }
  18. @pytest.fixture()
  19. def test_repo(http_repo: RepoServer) -> RepoServer:
  20. http_repo.import_json_data(SIMPLE_CATALOG)
  21. return http_repo
  22. @pytest.fixture()
  23. def test_project(tmp_project: Project, test_repo: RepoServer) -> Project:
  24. tmp_project.dds.repo_add(test_repo.url)
  25. return tmp_project
  26. def test_from_file(test_project: Project) -> None:
  27. """build-deps using a file listing deps"""
  28. test_project.write('deps.json5', json.dumps({'depends': ['neo-fun+0.3.0']}))
  29. test_project.dds.build_deps(['-d', 'deps.json5'])
  30. assert test_project.root.joinpath('_deps/neo-fun@0.3.0').is_dir()
  31. assert test_project.root.joinpath('_deps/_libman/neo-fun.lmp').is_file()
  32. assert test_project.root.joinpath('_deps/_libman/neo/fun.lml').is_file()
  33. assert test_project.root.joinpath('INDEX.lmi').is_file()
  34. def test_from_cmd(test_project: Project) -> None:
  35. """build-deps using a command-line listing"""
  36. test_project.dds.build_deps(['neo-fun=0.3.0'])
  37. assert test_project.root.joinpath('_deps/neo-fun@0.3.0').is_dir()
  38. assert test_project.root.joinpath('_deps/_libman/neo-fun.lmp').is_file()
  39. assert test_project.root.joinpath('_deps/_libman/neo/fun.lml').is_file()
  40. assert test_project.root.joinpath('INDEX.lmi').is_file()
  41. def test_multiple_deps(test_project: Project) -> None:
  42. """build-deps with multiple deps resolves to a single version"""
  43. test_project.dds.build_deps(['neo-fun^0.2.0', 'neo-fun~0.3.0'])
  44. assert test_project.root.joinpath('_deps/neo-fun@0.3.0').is_dir()
  45. assert test_project.root.joinpath('_deps/_libman/neo-fun.lmp').is_file()
  46. assert test_project.root.joinpath('_deps/_libman/neo/fun.lml').is_file()
  47. assert test_project.root.joinpath('INDEX.lmi').is_file()