slashms
slashms

Reputation: 978

Access TeamCity Environment variables with python script

I am using TeamCity to test my code. I am using command line from TC and I am running a python test suite that tests the code.

I defined an environment variable (named "Server") and gave it a value ("production") and I want to pass it in a way that my python script will be able to access it and save it's value in the code.

I tried looking in TC documentation as well in Python's documentation and I couldn't find it.

I will appreciate your help.

Upvotes: 0

Views: 2323

Answers (1)

Łukasz Rogalski
Łukasz Rogalski

Reputation: 23213

Probably you should use os.environ

assert os.environ['Server'] == 'production'

Upvotes: 4

Related Questions