Currently the operator allows to set requirement as list that needs to be hard coded.
It would be nice if airflow can support reading from file directly (something similar to how operators read sql file)
tests/decorators/test_python_virtualenv.py
import funcsigs  
        with self.dag:
            ret = f()
        ret.operator.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)
    def test_fail(self):
        @task.virtualenv()
        def f():
            raise Exception
        with self.dag:
            ret = f()
        with pytest.raises(CalledProcessError):
            ret.operator.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)
    def test_python_3(self):
        @task.virtualenv(python_version=3, use_dill=False, requirements=['dill'])
        def f():
            import sys
            print(sys.version)
            try:
                {}.iteritems()
            except AttributeError:
                return
            raise Exception
        with self.dag:
            ret = f()
        ret.operator.run(start_date=DEFAULT_DATE, end_date=DEFAULT_DATE)
    def test_with_args(self):