'ERROR Brownie Mainnet Fork Testing `brownie.exceptions.VirtualMachineError: revert` problem or other?

When I try to test below project, it gets below error. Any thoughts why test fails, am I missing something? I am following 16 hours Solidity course of 'freecodecamp` which is presented by Patrick Collins.

SOLIDITY CODE:

//SPDX-License-Identifier: MIT

pragma solidity ^0.6.6;

import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";

contract Lottery {
    address payable[] public players;
    uint256 public usdEntryFee;
    AggregatorV3Interface internal ethUsdPriceFeed;

    constructor(address _priceFeedAddress) public {
        usdEntryFee = 50 * (10**18);
        ethUsdPriceFeed = AggregatorV3Interface(_priceFeedAddress);
    }

    function enter() public payable {
        //en az 50 dolar
        require(msg.value >= getEntranceFee(), "Not enough ETH!");
        players.push(msg.sender);
    }

    function getEntranceFee() public view returns (uint256) {
        (, int256 price, , , ) = ethUsdPriceFeed.latestRoundData();
        uint256 adjustedPrice = uint256(price) * 10**10; //18 decimals
        uint256 costToEnter = (usdEntryFee * 10**18) / adjustedPrice;
        return costToEnter;
    }

    function startLottery() public {}

    function endLottery() public {}
}

TEST CODE:

from brownie import Lottery, accounts, config, network
from web3 import Web3

# 0.019 ETH
# 19000000000000000 WEI


def test_get_entrance_fee():
    account = accounts[0]
    lottery = Lottery.deploy(
        config["networks"]["mainnet-fork"]["eth_usd_price_feed"],
        {"from": account},
    )
    # lottery.tx.wait(1)
    # print(lottery)
    assert lottery.getEntranceFee() > Web3.toWei(0.017, "ether")
    assert lottery.getEntranceFee() < Web3.toWei(0.020, "ether")

CONFIG FILE:

dependencies:
  - smartcontractkit/[email protected]
compiler:
  solc:
    remappings:
        - '@chainlink=smartcontractkit/[email protected]'
networks:
  mainnet-fork:
    eth_usd_price_feed: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419'

ERROR PRINT i get: PS C:\Users\Aybars\smartcontract-lottery> brownie test --network mainnet-fork INFO: Could not find files for the given pattern(s). Brownie v1.16.4 - Python development framework for Ethereum

====================================================== test session starts ======================================================
platform win32 -- Python 3.10.2, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
rootdir: C:\Users\Aybars\smartcontract-lottery
plugins: eth-brownie-1.16.4, hypothesis-6.21.6, forked-1.3.0, xdist-1.34.0, web3-5.23.1
collected 1 item
Attached to local RPC client listening at '127.0.0.1:7545'...

tests\test_lottery.py F                                                                                                    [100%]

=========================================================== FAILURES ============================================================ 
_____________________________________________________ test_get_entrance_fee _____________________________________________________ 

    def test_get_entrance_fee():
        account = accounts[0]
        lottery = Lottery.deploy(
            config["networks"]["mainnet-fork"]["eth_usd_price_feed"],
            {"from": account},
        )
        # lottery.tx.wait(1)
        # print(lottery)
>       assert lottery.getEntranceFee() > Web3.toWei(0.017, "ether")

tests\test_lottery.py:16:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
..\AppData\Local\Programs\Python\Python310\lib\site-packages\brownie\network\multicall.py:115: in _proxy_call
    result = ContractCall.__call__(*args, **kwargs)  # type: ignore
..\AppData\Local\Programs\Python\Python310\lib\site-packages\brownie\network\contract.py:1729: in __call__
    return self.call(*args, block_identifier=block_identifier)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <ContractCall 'getEntranceFee()'>, block_identifier = None, args = ()
tx = {'allow_revert': None, 'data': '0x09bc33a7', 'from': '0xaE72Ea06d543D50B5E8DD07CDA2De4934926CdF4', 'gas': None, ...}

    def call(self, *args: Tuple, block_identifier: Union[int, str, bytes] = None) -> Any:
        """
        Call the contract method without broadcasting a transaction.

        Arguments
        ---------
        *args
            Contract method inputs. You can optionally provide a
            dictionary of transaction properties as the last arg.
        block_identifier : int | str | bytes, optional
            A block number or hash that the call is executed at. If not given, the
            latest block used. Raises `ValueError` if this value is too far in the
            past and you are not using an archival node.

        Returns
        -------
            Contract method return value(s).
        """

        args, tx = _get_tx(self._owner, args)
        if tx["from"]:
            tx["from"] = str(tx["from"])
        del tx["required_confs"]
        tx.update({"to": self._address, "data": self.encode_input(*args)})

        try:
            data = web3.eth.call({k: v for k, v in tx.items() if v}, block_identifier)
        except ValueError as e:
>           raise VirtualMachineError(e) from None
E           brownie.exceptions.VirtualMachineError: revert

..\AppData\Local\Programs\Python\Python310\lib\site-packages\brownie\network\contract.py:1533: VirtualMachineError
======================================================= warnings summary ======================================================== 
..\AppData\Local\Programs\Python\Python310\lib\site-packages\brownie\network\main.py:44
  C:\Users\Aybars\AppData\Local\Programs\Python\Python310\lib\site-packages\brownie\network\main.py:44: BrownieEnvironmentWarning: Development network has a block height of 49
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/warnings.html
==================================================== short test summary info ==================================================== 
FAILED tests/test_lottery.py::test_get_entrance_fee - brownie.exceptions.VirtualMachineError: revert
================================================= 1 failed, 1 warning in 2.45s ==================================================


Solution 1:[1]

I had the same issue while going through this course. Found an answer here: https://github.com/PatrickAlphaC/smartcontract-lottery/issues/28. I had a ganache instance running, so closing it solved the problem

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 Ruslan Akhtariev