This is actually a pretty complicated question because viral infections can damage the lungs in a way that makes subsequent bacterial infections possible/likely and it's often these that are fatal. So if co-occurring both may need to be treated, with different medications, or the viral infection may be ignored sometimes. It basically depends on the severity of the pneumonia (which I'm guessing it's what you mean by "chest infection"). For some background on causes of pneumonia:
Pneumonia is an infection of the lung that causes the alveoli, or air sacs, to fill up with fluid or pus. [...] If pneumonia does not resolve it can lead to acute respiratory distress syndrome (ARDS), sepsis, increased risk of cardiovascular disease, and decreased pulmonary function.
There are several viral infections that lead to pneumonia (16). Influenza A virus (IAV) primarily infects the lung epithelium, and can cause viral pneumonia. [...] There are also a variety of other viruses that can infect the lower respiratory tract and lead to pneumonia, including respiratory syncytial virus (RSV), parainfluenza, human metapneumonia, and some adenoviruses (14, 18–22). Rhinoviruses and newly described coronaviruses also infect the respiratory tract and cause disease. [...]
A variety of bacteria can also lead to the development of pneumonia. Bacterial pathogens as well as opportunistic infections (also known as pathobionts) can lead to pneumonia when allowed to infect the lower respiratory region. Bacteria that cause LRTIs naturally colonize the nasopharynx, but can cause disease when allowed to proliferate in the lower respiratory region (24–28). The most common examples of these are Streptococcus pneumoniae and Staphylococcus aureus. Other bacteria are acquired from the environment, and often these bacteria have specific virulence factors that allow for the adaptation and infection of the lower respiratory tract (29). [...]
The vast majority of research in infection biology has been devoted to studying the interactions of a single pathogen with a host. In addition to single infections causing pneumonia, a common complication following infection with respiratory viruses is bacterial pneumonia (9, 26, 39–56).Many clinical infections and presumably subclinical infections are often in fact coinfections, in that two (or more) pathogens simultaneously or in close temporal proximity infect a single host (9, 26, 39–59). These infections are termed secondary infection, superinfection, or coinfection. The simultaneous response of two pathogens can manifest in many ways and often results in increased morbidity and mortality.
To determine the best treatment options for patients with complex viral/bacterial coinfections increased understanding of the interplay between pathogens and the interaction with the host is necessary. Several viruses and bacteria have been shown to interact to worsen clinical outcomes. It is now believed that most of the deaths associated with the 1918 influenza pandemic were caused by superinfection with bacteria (60, 61). IAV/S. pneumoniae coinfection is perhaps the most well-studied example of viral/bacterial coinfection of the lung (62). However, bacterial coinfection also complicates infection with other respiratory viruses, including rhinovirus, metapneumonovirus, RSV, parainfluenza virus, adenovirus, and coronavirus (52, 63–66). Young children are especially vulnerable to bacterial complications following viral infection (44, 62, 67, 68).
So the NICE (i.e. UK) guidelines for diagnosing pneumonia say for example:
Community-acquired pneumonia (CAP) is a lower respiratory tract infection most commonly caused by bacteria; however, viruses are thought to cause approximately 13% of cases in adults, and approximately 66% of cases in children and young people. The main bacterial pathogen causing CAP is Streptococcus pneumoniae, followed by Haemophilus influenzae; epidemics of Mycoplasma pneumoniae occur approximately every 4 years in the UK, and mainly affect children.
Inappropriate prescribing of antibiotics for respiratory tract infections is common in general practice. [...]
So if you are an adult suffering from pneumonia (the Covid-19 pandemic aside) chances are you more likely you have bacterial pneumonia.
NG120 also emphasises the importance of face-to-face clinical examination in patients with acute cough if prescription of an antibiotic is being considered. Clinicians should therefore avoid issuing antibiotics for cough without a face-to-face examination. If bacterial pneumonia is suspected, it is important to assess the clinical signs and to determine their severity. [...]
An antibiotic should be offered within 4 hours of establishing a diagnosis of pneumonia, and a 5-day course is considered appropriate in all severity gradings.
Also worth quoting from those guidelines:
In practice, patients often return at the end of the antibiotic course due to concerns that symptoms have not resolved; however, in pneumonia, we should not expect symptom resolution at this stage. When issuing an antibiotic, it is important to explain to patients that their symptoms are highly unlikely to have resolved at the end of the course, but that the infection will have been adequately treated. It may be helpful to bear in mind that chest X-rays are not expected to return to normal for up to 6 weeks after pneumonia, reflecting the ongoing inflammatory rather than infective process.
Sputum samples do not need to be routinely sent for patients with CAP treated in primary care. However, they can be useful if signs or symptoms have not improved as expected after antibiotic treatment, or in people who have previously had frequent courses of antibiotics, as this increases the likelihood of resistant organisms.
Basically, unless the pneumonia is severe enough (to require hospitalization), you won't get a test to determine the agent that caused it, unless the first course antibiotic doesn't resolve it.
I can tell you from general experience that the cause of pneumonia will get tested in severe cases in a hospital setting in almost any country. (There are probably some WHO guidelines for this, but I can't be bothered to search them now.)
Short coda on Covid-19:
A study of 191 patients in two Wuhan hospitals showed that 50 percent of those who died tested positive for secondary infections compared to only one of the 137 survivors. In this situation, antibiotics form a crucial second line of defence. Many studies indicate that nearly all severe COVID-19 patients will receive antibiotics.