Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

test_basics.py 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. from typing import ContextManager
  2. from pathlib import Path
  3. from tests import DDS
  4. from tests.fileutil import ensure_dir, set_contents
  5. def test_build_empty(dds: DDS) -> None:
  6. assert not dds.source_root.exists()
  7. dds.scope.enter_context(ensure_dir(dds.source_root))
  8. dds.build()
  9. def test_build_simple(dds: DDS) -> None:
  10. dds.scope.enter_context(set_contents(dds.source_root / 'src/f.cpp', b'void foo() {}'))
  11. dds.build()
  12. def basic_pkg_dds(dds: DDS) -> ContextManager[Path]:
  13. return set_contents(
  14. dds.source_root / 'package.json5', b'''
  15. {
  16. name: 'test-pkg',
  17. version: '0.2.2',
  18. namespace: 'test',
  19. }
  20. ''')
  21. def test_empty_with_pkg_dds(dds: DDS) -> None:
  22. dds.scope.enter_context(basic_pkg_dds(dds))
  23. dds.build()
  24. def test_empty_with_lib_dds(dds: DDS) -> None:
  25. dds.scope.enter_context(basic_pkg_dds(dds))
  26. dds.build()
  27. def test_empty_sdist_create(dds: DDS) -> None:
  28. dds.scope.enter_context(basic_pkg_dds(dds))
  29. dds.sdist_create()
  30. def test_empty_sdist_export(dds: DDS) -> None:
  31. dds.scope.enter_context(basic_pkg_dds(dds))
  32. dds.sdist_export()