java.lang.RuntimeException: no screen devices when running unit tests from TeamCity

When I try to run my unit tests via gradle in TeamCity for my plugin project, all fail with the following exception.  Am I missing some kind of a setting or flag?

java.lang.RuntimeException: java.lang.RuntimeException: no screen devices
    at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl$21.run(CodeInsightTestFixtureImpl.java:1220)
    at com.intellij.util.ui.UIUtil.invokeAndWaitIfNeeded(UIUtil.java:2398)
    at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.setUp(CodeInsightTestFixtureImpl.java:1212)
    at com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase.setUp(LightPlatformCodeInsightFixtureTestCase.java:65)
    at com.intellij.testFramework.UsefulTestCase.defaultRunBare(UsefulTestCase.java:341)
    at com.intellij.testFramework.UsefulTestCase$4.run(UsefulTestCase.java:428)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744)
    at java.awt.EventQueue.access$400(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:697)
    at java.awt.EventQueue$3.run(EventQueue.java:691)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:714)
    at com.intellij.ide.IdeEventQueue.e(IdeEventQueue.java:734)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:569)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.RuntimeException: no screen devices
    at com.intellij.openapi.ui.TestDialog$1.show(TestDialog.java:23)
    at com.intellij.openapi.ui.Messages.showDialog(Messages.java:263)
    at com.intellij.openapi.ui.Messages.showDialog(Messages.java:288)
    at com.intellij.openapi.ui.Messages.showDialog(Messages.java:299)
    at com.intellij.openapi.ui.Messages.showErrorDialog(Messages.java:729)
    at com.intellij.openapi.project.impl.ProjectManagerImpl.newProject(ProjectManagerImpl.java:279)
    at com.intellij.openapi.project.impl.ProjectManagerImpl.newProject(ProjectManagerImpl.java:230)
    at com.intellij.testFramework.PlatformTestCase.createProject(PlatformTestCase.java:252)
    at com.intellij.testFramework.LightPlatformTestCase$2.run(LightPlatformTestCase.java:252)
    at com.intellij.openapi.command.WriteCommandAction$Simple.run(WriteCommandAction.java:166)
    at com.intellij.openapi.application.RunResult.run(RunResult.java:38)
    at com.intellij.openapi.command.WriteCommandAction$2$1.run(WriteCommandAction.java:114)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:937)
    at com.intellij.openapi.command.WriteCommandAction$2.run(WriteCommandAction.java:111)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:124)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:99)
    at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:108)
    at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:80)
    at com.intellij.testFramework.LightPlatformTestCase.a(LightPlatformTestCase.java:236)
    at com.intellij.testFramework.LightPlatformTestCase.doSetup(LightPlatformTestCase.java:399)
    at com.intellij.testFramework.fixtures.impl.LightIdeaTestFixtureImpl.setUp(LightIdeaTestFixtureImpl.java:51)
    at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl$21.run(CodeInsightTestFixtureImpl.java:1216)
    ... 22 more

Please sign in to leave a comment.