mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	testing: Run in parallel mode by default.
This commit changes the backend testing framework to run in parallel mode which is same as --processes=4. If --coverage is supplied, we enforce serial mode, --processes=1, because coverage is not compatible with parallel mode at the moment.
This commit is contained in:
		@@ -24,10 +24,11 @@ or just done things that are kind of unique in Zulip.
 | 
			
		||||
## Running tests
 | 
			
		||||
 | 
			
		||||
Our tests live in `zerver/tests/`. You can run them with
 | 
			
		||||
`./tools/test-backend`. It generally takes about a minute to run
 | 
			
		||||
the entire test suite.  When you are in iterative mode, you
 | 
			
		||||
can run individual tests or individual modules, following the
 | 
			
		||||
dotted.test.name convention below:
 | 
			
		||||
`./tools/test-backend`. The tests run in parallel using multiple
 | 
			
		||||
threads in your development environment, and can finish in under 30s
 | 
			
		||||
on a fast machine.  When you are in iterative mode, you can run
 | 
			
		||||
individual tests or individual modules, following the dotted.test.name
 | 
			
		||||
convention below:
 | 
			
		||||
 | 
			
		||||
    cd /srv/zulip
 | 
			
		||||
    ./tools/test-backend zerver.tests.test_queue_worker.WorkerTest
 | 
			
		||||
 
 | 
			
		||||
@@ -144,7 +144,8 @@ if __name__ == "__main__":
 | 
			
		||||
                      dest="fatal_errors", help="Continue past test failures to run all tests")
 | 
			
		||||
    parser.add_option('--coverage', dest='coverage',
 | 
			
		||||
                      action="store_true",
 | 
			
		||||
                      default=False, help='Compute test coverage.')
 | 
			
		||||
                      default=False,
 | 
			
		||||
                      help='Compute test coverage. Enforces processes=1.')
 | 
			
		||||
    parser.add_option('--verbose-coverage', dest='verbose_coverage',
 | 
			
		||||
                      action="store_true",
 | 
			
		||||
                      default=False, help='Enable verbose print of coverage report.')
 | 
			
		||||
@@ -160,9 +161,9 @@ if __name__ == "__main__":
 | 
			
		||||
                      type="int",
 | 
			
		||||
                      callback=allow_positive_int,
 | 
			
		||||
                      action='callback',
 | 
			
		||||
                      default=1,
 | 
			
		||||
                      default=4,
 | 
			
		||||
                      help='Specify the number of processes to run the '
 | 
			
		||||
                           'tests in. Default is 1.')
 | 
			
		||||
                           'tests in. Default is 4.')
 | 
			
		||||
    parser.add_option('--profile', dest='profile',
 | 
			
		||||
                      action="store_true",
 | 
			
		||||
                      default=False, help='Profile test runtime.')
 | 
			
		||||
@@ -195,6 +196,11 @@ if __name__ == "__main__":
 | 
			
		||||
                            "test-backend was run.  Implies --nonfatal-errors."))
 | 
			
		||||
 | 
			
		||||
    (options, args) = parser.parse_args()
 | 
			
		||||
    if options.coverage:
 | 
			
		||||
        # Currently coverage doesn't work with parallel mode, so when
 | 
			
		||||
        # coverage parameter is supplied we enfore serial mode.
 | 
			
		||||
        print("Disabling parallel mode because coverage isn't supported.")
 | 
			
		||||
        options.processes = 1
 | 
			
		||||
 | 
			
		||||
    zerver_test_dir = 'zerver/tests/'
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user