'How to parametrize the pytest cases below with patch.dict?
def test_index_file_generator_windows(self):
# ARRANGE
# ACT
actual: str = index_file_name_generator(...)
# ASSERT
folder = "."
expected: str = os.path.join(folder, self.filename)
assert expected == actual
@patch.dict(os.environ, {"STREAM_INDEX": "/var/lib/stream_index"})
def test_index_file_generator_linux(self):
# ARRANGE
# ACT
actual: str = index_file_name_generator(...)
# ASSERT
folder = os.environ['STREAM_INDEX']
expected: str = os.path.join(folder, self.filename)
assert expected == actual
One of the test cases would need to use patch.dict, while the other test does not.
How do use pytest.mark.parametrize to combine both test cases? or am I better off to write separate test cases?
Solution 1:[1]
You can get all of your contacts with this package (flutter_contacts) after that you can parse to String the list of contacts and then create a QR Code with this package (qr_flutter).
If you want parse the entire list:
contacts.toString();
If you want parse every contacts of your contact list:
final result = contacts.map((contact) => contact.toString());
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
