BEIJING—For weeks, Beijing has teetered on the edge of a hard, Covid-induced lockdown. For the most part, citizens are unruffled, confident that the restrictions that have paralyzed Shanghai for six weeks are simply unthinkable in the capital.

In recent days, primary and secondary school classes have been forced to move online. Restaurants and bars have been closed to in-store dining, dozens of subway stations have been shut and supermarket shelves have been stripped bare and then restocked several times.

None of this has been enough to bother Sun Yanxu, a 35-year-old delivery driver who moved to Beijing earlier this year. “I haven’t stockpiled anything and don’t think it’s necessary,” he said, adding that he didn’t have a problem with the government’s handling of the outbreaks and didn’t think Beijing would be locked down.

“I believe in the government and think all the restrictions are correct and it’s just a matter of people obeying them or not,” Mr. Sun said. Though Mr. Sun said Beijing’s tightening Covid-19 restrictions haven’t yet hampered his movements, the native of the central Chinese province of Shanxi said his income had been hit by the stricter rules.

Similarly, Lü Xiyao, a 28-year-old yoga instructor from the neighboring province of Hubei, said she didn’t feel a need to stock up on groceries, confident that Beijing would avoid a Shanghai-style lockdown.

Even so, Ms. Lü, who was eating lunch with a friend outside a shopping mall in central Beijing on a recent afternoon because of the ban on indoor dining, hopes that the restrictions will be lifted soon. She said she is being paid only a basic salary, without the extra money she would ordinarily receive for teaching classes.

“If the situation persists for too long, I’ll just have to go home,” Ms. Lü said.

As most of the world relaxes its Covid restrictions following a global surge in cases caused by the highly transmissible Omicron variant of the coronavirus, China has stuck with its zero-tolerance approach. The effort to stamp out infection clusters has led to full or partial lockdowns on dozens of cities, affecting hundreds of millions of people.

After a Thursday meeting, the Communist Party’s ruling Politburo issued a statement redoubling its commitment to strict pandemic controls. “We won the battle in Wuhan, and we will surely be able to win the battle in Shanghai,” the Politburo said, drawing a comparison between the Chinese financial capital hardest hit by the current outbreak and the city of Wuhan, where the coronavirus first emerged more than two years ago.

On Sunday, Chinese health authorities recorded 4,243 new locally transmitted infections nationwide for the prior day, with Shanghai accounting for almost all of them. The megacity of 25 million people, now in the sixth week of its lockdown, reported 3,840 new infections, marking the fifth consecutive day in which there were fewer than 5,000 daily cases and the lowest daily count since March 27.

Even so, restrictions in Shanghai have only partially eased, allowing residents in some areas of the city to leave their apartments but not their residential compounds. On Saturday, Shanghai municipal officials postponed citywide college-entrance exams.

Beijing authorities on Saturday began a new round of mass testing in five districts, as well as areas that have reported positive tests since late April.

Photo: jade gao/Agence France-Presse/Getty Images

Beijing, meantime, has rolled a steady drumbeat of tightening measures in recent weeks that have prompted a small number of residents to flee the city and many others to restock their pantries.

While cases in the capital have been rising, new infections have yet to pass 100 on a daily basis. On Saturday afternoon, municipal health authorities announced 78 cases in the previous 24 hours, Beijing’s highest daily count during the current outbreak.

“The current trajectory of cases suggests the risk of a full lockdown is low,” Ernan Cui, an analyst at consulting firm Gavekal Dragonomics, told clients in a note Friday. “Beijing appears to be developing a new model of Covid containment based on frequent testing…in order to spot and isolate new chains of transmission before cases reach even low levels.”

Even so, she warned, “the risk that new outbreaks or a new variant will result in another wave of lockdowns in the future is still there, and will be until China makes a more fundamental shift in its Covid policies.”

Authorities in the capital on Saturday began a new round of mass testing in five districts, as well as areas that have reported positive tests since April 25. More than 60 subway stations in Beijing have been closed, while dining-in at restaurants has been barred for more than a week.

Late Friday, authorities in Chaoyang district, Beijing’s most populous, ordered indoor entertainment venues, gyms and training centers to close until further notice. Office workers in the district were also instructed to work from home; the offices of government agencies and state-owned companies are now capped at 50% occupancy.

A negative Covid result from within the prior 48 hours had already been needed to enter many venues. Since Thursday, the list of activities requiring a negative test was expanded to include getting married, Beijing’s Civil Affairs Bureau said in an announcement posted on its website.

That addition prompted a torrent of satirical responses on social media. “When finding a good marriage partner, one used to consult a fortuneteller. Later, it became an astrologer. Now, it’s a negative Covid test,” one internet user joked on China’s Twitter -like Weibo.

Despite the new measures, Beijing residents remain relatively sanguine about the prospects of authorities imposing tighter restrictions.

“I don’t think Beijing will repeat what’s happening in Shanghai, where officials didn’t control Covid properly in the early stages,” said Mr. Zhou, who declined to give his full name. “Beijing is the capital city, after all.”

The 30-year-old native of the northeastern Chinese city of Harbin moved to Beijing earlier this year to work in sales, said he hadn’t loaded up on groceries and felt no need to do so.

“The supermarkets are full of supplies and stockpiling will only push prices higher,” Mr. Zhou said, adding that restrictions on restaurants and public transportation were reasonable measures that didn’t affect his own personal life.

“I’m relatively optimistic about the current situation in Beijing,” he said, though he predicted it would take several years before the virus is a thing of the past. “It’s up to officials to make the policies. I trust the government and don’t think there will be a citywide lockdown.”

Nearby, Ms. Huang, who said she worked in a Beijing supermarket and who also declined to give her full name, recalled stockpiling essentials when Covid-19 first burst out in early 2020. This time around, Ms. Huang hadn’t bothered, even as she watched customers clean out her store’s shelves in recent weeks.

“Beijing should have learned a lesson from Shanghai,” she reasoned. “And the government has done a good job in ensuring supplies.”

Not everyone is so optimistic. One local real-estate agent in his 40s said that while Beijing would likely be spared a Shanghai-style lockdown, he lamented the ban on indoor dining and said he was deeply troubled by the harshness of the measures taken by the authorities across the country.

“It’s all too much. Everywhere you go, there’s a lockdown,” said the man, who declined to be identified by his full name and gave his surname as Wang. “Something’s really wrong…People from high up don’t see the hardship that people at the bottom have to endure.”

Write to Jonathan Cheng at jonathan.cheng@wsj.com and Joyu Wang at joyu.wang@wsj.com