---
title: on_viceroy
summary: Decorator for making a method run on the testrunner's Viceroy server
url: https://www.fastly.com/documentation/reference/compute/sdks/python/fastly_compute/testing/viceroy/fn.on_viceroy/
---

**Kind:** Function  
**Module:** [viceroy](https://www.fastly.com/documentation/reference/compute/sdks/python/fastly_compute/testing/viceroy/)  
**Package:** fastly-compute 0.1.3  
**Source:** https://github.com/fastly/compute-sdk-python/blob/2bffcc6d596a68bcc0b4342404641deff78e68f6/fastly_compute/testing/viceroy.py#L444

```python
on_viceroy(method) -> classmethod
```

Decorator for making a method run on the testrunner's Viceroy server

Decorate a method with this, and it will automagically run under Viceroy
when called. The method must be in a subclass of AutoViceroyTestBase.

* Return values and raised exceptions must be pickleable.
* If the decorated method is not already a class method, we make it one, in
service to conciseness.

**Parameters**

- `method`: `Any`

**Returns**

`classmethod`
