From the course: GitHub Copilot for System-Level Development
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Mocking dependencies with Copilot - Github Copilot Tutorial
From the course: GitHub Copilot for System-Level Development
Mocking dependencies with Copilot
- [Instructor] Marking dependencies is a crucial way of dealing with tests, specifically, when certain things can get out of control. In this case, for example, the run_cli is calling on Python 3. This is doing a system call. We can do a little bit better. There's a problem here where if for whatever reason, Python 3 does not exist in the system where this test is being run, we're going to get into trouble here. Now, these are particulars of Python. It requires a runtime. There's several different things that would need to come to be true in a system in order for this to run correctly. I want to avoid that. And so, I've written this prompt, which is this test cli.py file is calling Python 3 directly. I want to avoid relying on Python 3 executable being available in the system. So, I want to create a mock that can act on behalf of the CLI being called directly. So, I want to fake that in order to avoid calling the…