I want to do a gradle build but not run the unit tests.

You should use the -x command line argument which excludes any task.

Try:

gradle build -x test