Hi community, I have a debugging question. I have ...
# general
h
Hi community, I have a debugging question. I have a http server, when I run following command, it starts without any issue. Here
start_server
is a
pex_binary
target
Copy code
pants run path/to/server:start_server -- arg1
I wrote some local integration test for this service. Before the test cases start, I start this http server by using following code. But the server does not start at all. And there is no log output from server, even I try to log at the first line of my main function of my server. Do you have any suggestion to debug this case? I just want to see some logs or stack trace at the http server side.
Copy code
@classmethod
    def setUpClass(cls):
        cls.server_process = subprocess.Popen([
            "pants", "run", "path/to/server:start_server", "--", "arg1"
        ])
        time.sleep(2)  # Give server time to start
I guess I probably run pants inside a pants process, which may cause weird issue.
c
You are trying to run a test with Pants that shells out to invoke pants? I don't think that will run today unless you run one of those without the daemon https://github.com/pantsbuild/pants/issues/20642 Assuming
path/to/server:start_server
is python, you might be able to 'just' import and run that as normal code, or at least using common pytest plugins/idioms. (We for example use the pytest docker compose plugin for some web server integration tests)
h
Got it. Thank you for your reply!