conanfile.py 857 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import os
  4. import subprocess
  5. import requests
  6. import time
  7. from conans import ConanFile, CMake, tools, RunEnvironment
  8. class TestPackageConan(ConanFile):
  9. settings = "os", "compiler", "build_type", "arch"
  10. generators = "cmake"
  11. def build(self):
  12. cmake = CMake(self)
  13. cmake.configure()
  14. cmake.build()
  15. def test(self):
  16. assert os.path.isfile(os.path.join(self.deps_cpp_info["civetweb"].rootpath, "licenses", "LICENSE.md"))
  17. bin_path = os.path.join(os.getcwd(), "bin", "test_package")
  18. with tools.environment_append(RunEnvironment(self).vars):
  19. process = subprocess.Popen([bin_path], shell=True)
  20. time.sleep(2)
  21. response = requests.get("http://localhost:8080/example")
  22. assert response.ok
  23. process.kill()