Most U.S. states that have regulated and taxed cannabis have imposed some form of mandatory safety testing requirements. In California, the country's largest and oldest legal cannabis market, mandatory testing was first enforced by state regulators in July 2018, and additional mandatory tests were introduced at the end of 2018. All cannabis must be tested and labeled as certified by a state-licensed cannabis testing laboratory before it can be legally marketed in California. Every batch that is sold by licensed retailers must be tested for more than 100 contaminants, including 66 pesticides with tolerance levels lower than the levels allowable for any other agricultural product in California. This paper estimates the costs of compliance with mandatory cannabis testing laws and regulations, using California's testing regime as a case study. We use state government data, data collected from testing laboratories, and data collected from lab equipment suppliers to run a set of Monte Carlo simulations and estimate the cost per pound of compliance with California's new cannabis testing regulations. We find that cost per pound is highly sensitive to average batch size and testing failure rates. We present results under a variety of different assumptions about batch size and failure rates. We also find that under realistic assumptions, the loss of cannabis that must be destroyed if a batch fails testing accounts for a larger share of total testing costs than does the cost of the lab tests. Using our best estimates of average batch size (8 pounds) and failure rate (4%) in the 2019 California market, we estimate testing cost at $136 per pound of dried cannabis flower, or about 10 percent of the reported average wholesale price of legal cannabis in the state. Our findings explain effects of the testing standards on the cost of supplying legal licensed cannabis, in California, other U.S. states, and foreign jurisdictions with similar testing regimes.